FullNodeConfiguration: make use of the getOrElse helper

This commit is contained in:
Andrius Dagys 2016-10-05 15:52:58 +01:00
parent 727c3ac5fc
commit e5072a8854

View File

@ -131,11 +131,11 @@ class FullNodeConfiguration(conf: Config) : NodeConfiguration {
override val trustStorePassword: String by conf override val trustStorePassword: String by conf
override val dataSourceProperties: Properties by conf override val dataSourceProperties: Properties by conf
override val devMode: Boolean by conf.getOrElse { false } override val devMode: Boolean by conf.getOrElse { false }
val networkMapAddress: HostAndPort? = if (conf.hasPath("networkMapAddress")) HostAndPort.fromString(conf.getString("networkMapAddress")) else null val networkMapAddress: HostAndPort? by conf.getOrElse { null }
val useHTTPS: Boolean by conf val useHTTPS: Boolean by conf
val artemisAddress: HostAndPort by conf val artemisAddress: HostAndPort by conf
val webAddress: HostAndPort by conf val webAddress: HostAndPort by conf
val messagingServerAddress: HostAndPort? = if (conf.hasPath("messagingServerAddress")) HostAndPort.fromString(conf.getString("messagingServerAddress")) else null val messagingServerAddress: HostAndPort? by conf.getOrElse { null }
val extraAdvertisedServiceIds: String by conf val extraAdvertisedServiceIds: String by conf
fun createNode(): Node { fun createNode(): Node {
@ -146,7 +146,7 @@ class FullNodeConfiguration(conf: Config) : NodeConfiguration {
} }
} }
if (networkMapAddress == null) advertisedServices.add(ServiceInfo(NetworkMapService.Type)) if (networkMapAddress == null) advertisedServices.add(ServiceInfo(NetworkMapService.Type))
val networkMapMessageAddress: SingleMessageRecipient? = if (networkMapAddress == null) null else NodeMessagingClient.makeNetworkMapAddress(networkMapAddress) val networkMapMessageAddress: SingleMessageRecipient? = if (networkMapAddress == null) null else NodeMessagingClient.makeNetworkMapAddress(networkMapAddress!!)
return Node(this, networkMapMessageAddress, advertisedServices) return Node(this, networkMapMessageAddress, advertisedServices)
} }
} }