CORPRIV-661: Ensure that nodes loaded from a profile have the correct network map service.

This commit is contained in:
Chris Rankin 2017-02-22 17:04:42 +00:00
parent 963d015c4d
commit 5a13d0355d
2 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,8 @@ class NodeConfig(
val webPort: Int,
val h2Port: Int,
val extraServices: List<String>,
val users: List<Map<String, Any>> = listOf(defaultUser)
val users: List<Map<String, Any>> = listOf(defaultUser),
var networkMap: NetworkMapConfig? = null
) : NetworkMapConfig(legalName, artemisPort) {
companion object {
@ -38,8 +39,6 @@ class NodeConfig(
override val keyStorePassword: String = "cordacadevpass"
}
var networkMap: NetworkMapConfig? = null
var state: NodeState = NodeState.STARTING
val isCashIssuer: Boolean = extraServices.any {
@ -69,7 +68,7 @@ class NodeConfig(
fun toText(): String = toFileConfig().root().render(renderOptions)
fun moveTo(baseDir: Path) = NodeConfig(
baseDir, legalName, artemisPort, nearestCity, webPort, h2Port, extraServices, users
baseDir, legalName, artemisPort, nearestCity, webPort, h2Port, extraServices, users, networkMap
)
}

View File

@ -104,6 +104,8 @@ class ProfileController : Controller() {
if (config.hasPath("networkMapService")) {
val nmap = config.getConfig("networkMapService")
nodeConfig.networkMap = NetworkMapConfig(nmap.getString("legalName"), nmap.parsePort("address"))
} else {
log.info("Node '${nodeConfig.legalName}' is the network map")
}
return nodeConfig