mirror of
https://github.com/corda/corda.git
synced 2025-02-01 16:58:27 +00:00
Simplify the FullNodeConfiguration now that an explicit identity for the NetworkMapService isn't a problem.
Use consistent if style Don't include NetworkMapAddress in config if hosting locally
This commit is contained in:
parent
c7b164897b
commit
1f2a6d256e
@ -1,15 +1,11 @@
|
||||
basedir : "./nodea",
|
||||
myLegalName : "Bank A",
|
||||
nearestCity : "London",
|
||||
keyStorePassword : "cordacadevpass",
|
||||
trustStorePassword : "trustpass",
|
||||
artemisAddress : "localhost:31337",
|
||||
webAddress : "localhost:31339",
|
||||
hostNotaryServiceLocally: false,
|
||||
extraAdvertisedServiceIds: "corda.interest_rates",
|
||||
mapService : {
|
||||
hostServiceLocally : false,
|
||||
address : "localhost:12345",
|
||||
identity : "Notary Service"
|
||||
}
|
||||
basedir : "./nodea"
|
||||
myLegalName : "Bank A"
|
||||
nearestCity : "London"
|
||||
keyStorePassword : "cordacadevpass"
|
||||
trustStorePassword : "trustpass"
|
||||
artemisAddress : "localhost:31337"
|
||||
webAddress : "localhost:31339"
|
||||
hostNotaryServiceLocally: false
|
||||
extraAdvertisedServiceIds: "corda.interest_rates"
|
||||
networkMapAddress : "localhost:12345"
|
||||
useHTTPS : false
|
||||
|
@ -1,15 +1,11 @@
|
||||
basedir : "./nodeb",
|
||||
myLegalName : "Bank B",
|
||||
nearestCity : "London",
|
||||
keyStorePassword : "cordacadevpass",
|
||||
trustStorePassword : "trustpass",
|
||||
artemisAddress : "localhost:31338",
|
||||
webAddress : "localhost:31340",
|
||||
hostNotaryServiceLocally: false,
|
||||
extraAdvertisedServiceIds: "corda.interest_rates",
|
||||
mapService : {
|
||||
hostServiceLocally : false,
|
||||
address : "localhost:12345",
|
||||
identity : "Notary Service"
|
||||
}
|
||||
basedir : "./nodeb"
|
||||
myLegalName : "Bank B"
|
||||
nearestCity : "London"
|
||||
keyStorePassword : "cordacadevpass"
|
||||
trustStorePassword : "trustpass"
|
||||
artemisAddress : "localhost:31338"
|
||||
webAddress : "localhost:31340"
|
||||
hostNotaryServiceLocally: false
|
||||
extraAdvertisedServiceIds: "corda.interest_rates"
|
||||
networkMapAddress : "localhost:12345"
|
||||
useHTTPS : false
|
||||
|
@ -1,15 +1,10 @@
|
||||
basedir : "./nameserver",
|
||||
myLegalName : "Notary Service",
|
||||
nearestCity : "London",
|
||||
keyStorePassword : "cordacadevpass",
|
||||
trustStorePassword : "trustpass",
|
||||
artemisAddress : "localhost:12345",
|
||||
webAddress : "localhost:12346",
|
||||
hostNotaryServiceLocally: true,
|
||||
extraAdvertisedServiceIds: "",
|
||||
mapService : {
|
||||
hostServiceLocally : true,
|
||||
address : ${artemisAddress},
|
||||
identity : ${myLegalName}
|
||||
}
|
||||
basedir : "./nameserver"
|
||||
myLegalName : "Notary Service"
|
||||
nearestCity : "London"
|
||||
keyStorePassword : "cordacadevpass"
|
||||
trustStorePassword : "trustpass"
|
||||
artemisAddress : "localhost:12345"
|
||||
webAddress : "localhost:12346"
|
||||
hostNotaryServiceLocally: true
|
||||
extraAdvertisedServiceIds: ""
|
||||
useHTTPS : false
|
@ -40,11 +40,7 @@ General node configuration file for hosting the IRSDemo services.
|
||||
webAddress : "localhost:31339"
|
||||
hostNotaryServiceLocally: false
|
||||
extraAdvertisedServiceIds: "corda.interest_rates"
|
||||
mapService : {
|
||||
hostServiceLocally : false
|
||||
address : "localhost:12345"
|
||||
identity : "Notary Service"
|
||||
}
|
||||
networkMapAddress : "localhost:12345"
|
||||
useHTTPS : false
|
||||
|
||||
NetworkMapService plus Simple Notary configuration file.
|
||||
@ -60,11 +56,6 @@ NetworkMapService plus Simple Notary configuration file.
|
||||
webAddress : "localhost:12346"
|
||||
hostNotaryServiceLocally: true
|
||||
extraAdvertisedServiceIds: ""
|
||||
mapService : {
|
||||
hostServiceLocally : true
|
||||
address : ${artemisAddress}
|
||||
identity : ${myLegalName}
|
||||
}
|
||||
useHTTPS : false
|
||||
|
||||
Configuration File Fields
|
||||
@ -103,11 +94,7 @@ Configuration File Fields
|
||||
|
||||
:extraAdvertisedServiceIds: A list of ServiceType id strings to be advertised to the NetworkMapService and thus be available when other nodes query the NetworkMapCache for supporting nodes. This can also include plugin services loaded from .jar files in the
|
||||
|
||||
:mapService.hostServiceLocally: If true the node is declaring itself as the NetworkMapService host. Otherwise the configuration below is the remote connection details for the node to connect to the NetworkMapService.
|
||||
|
||||
:mapService.address: If the node is hosting the NetworkMapService this should be exactly equal to the artemisAddress (hence $ substitution above). Otherwise this value is the remote HostAndPort string for the ArtemisMQ service on the hosting node.
|
||||
|
||||
:mapService.identity: If the node is hosting the NetworkMapService this should be exactly equal to the myLegalName (hence $ substitution above). Otherwise this value must match the myLegalName of the hosting node.
|
||||
:networkMapAddress: If `null`, or missing the node is declaring itself as the NetworkMapService host. Otherwise the configuration value is the remote HostAndPort string for the ArtemisMQ service on the hosting node.
|
||||
|
||||
:useHTTPS: If false the node's web server will be plain HTTP. If true the node will use the same certificate and private key from the ``<workspace>/certificates/sslkeystore.jks`` file as the ArtemisMQ port for HTTPS. If HTTPS is enabled then unencrypted HTTP traffic to the node's **webAddress** port is not supported.
|
||||
|
||||
|
@ -90,12 +90,6 @@ class NodeConfigurationFromConfig(val config: Config = ConfigFactory.load()) : N
|
||||
override val dataSourceProperties: Properties by config
|
||||
}
|
||||
|
||||
class NameServiceConfig(conf: Config) {
|
||||
val hostServiceLocally: Boolean by conf
|
||||
val address: HostAndPort by conf
|
||||
val identity: String by conf
|
||||
}
|
||||
|
||||
class FullNodeConfiguration(conf: Config) : NodeConfiguration {
|
||||
val basedir: Path by conf
|
||||
override val myLegalName: String by conf
|
||||
@ -108,28 +102,26 @@ class FullNodeConfiguration(conf: Config) : NodeConfiguration {
|
||||
val artemisAddress: HostAndPort by conf
|
||||
val webAddress: HostAndPort by conf
|
||||
val messagingServerAddress: HostAndPort? = if (conf.hasPath("messagingServerAddress")) HostAndPort.fromString(conf.getString("messagingServerAddress")) else null
|
||||
val networkMapAddress: HostAndPort? = if (conf.hasPath("networkMapAddress")) HostAndPort.fromString(conf.getString("networkMapAddress")) else null
|
||||
val hostNotaryServiceLocally: Boolean by conf
|
||||
val extraAdvertisedServiceIds: String by conf
|
||||
val mapService: NameServiceConfig = NameServiceConfig(conf.getConfig("mapService"))
|
||||
val clock: Clock = NodeClock()
|
||||
|
||||
fun createNode(): Node {
|
||||
val networkMapTarget = ArtemisMessagingClient.makeNetworkMapAddress(mapService.address)
|
||||
val advertisedServices = mutableSetOf<ServiceType>()
|
||||
if (mapService.hostServiceLocally) advertisedServices.add(NetworkMapService.Type)
|
||||
if (hostNotaryServiceLocally) advertisedServices.add(SimpleNotaryService.Type)
|
||||
if (!extraAdvertisedServiceIds.isNullOrEmpty()) {
|
||||
for (serviceId in extraAdvertisedServiceIds.split(",")) {
|
||||
advertisedServices.add(object : ServiceType(serviceId) {})
|
||||
}
|
||||
}
|
||||
|
||||
val networkMapAddress: SingleMessageRecipient? = if (mapService.hostServiceLocally) null else networkMapTarget
|
||||
if (networkMapAddress == null) advertisedServices.add(NetworkMapService.Type)
|
||||
val networkMapMessageAddress: SingleMessageRecipient? = if (networkMapAddress == null) null else ArtemisMessagingClient.makeNetworkMapAddress(networkMapAddress)
|
||||
return Node(basedir.toAbsolutePath().normalize(),
|
||||
artemisAddress,
|
||||
webAddress,
|
||||
this,
|
||||
networkMapAddress,
|
||||
networkMapMessageAddress,
|
||||
advertisedServices,
|
||||
clock,
|
||||
messagingServerAddress
|
||||
|
Loading…
x
Reference in New Issue
Block a user