mirror of
https://github.com/corda/corda.git
synced 2024-12-20 13:33:12 +00:00
Remove NodeConfigurationFromConfig and replace usages with FullNodeConfiguration
This commit is contained in:
parent
9707ce7367
commit
fac12b4fce
@ -9,7 +9,6 @@ import com.r3corda.core.node.services.NetworkMapCache
|
|||||||
import com.r3corda.core.node.services.ServiceInfo
|
import com.r3corda.core.node.services.ServiceInfo
|
||||||
import com.r3corda.node.services.config.FullNodeConfiguration
|
import com.r3corda.node.services.config.FullNodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfiguration
|
import com.r3corda.node.services.config.NodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfigurationFromConfig
|
|
||||||
import com.r3corda.node.services.messaging.ArtemisMessagingComponent
|
import com.r3corda.node.services.messaging.ArtemisMessagingComponent
|
||||||
import com.r3corda.node.services.messaging.ArtemisMessagingServer
|
import com.r3corda.node.services.messaging.ArtemisMessagingServer
|
||||||
import com.r3corda.node.services.messaging.NodeMessagingClient
|
import com.r3corda.node.services.messaging.NodeMessagingClient
|
||||||
@ -327,7 +326,7 @@ class DriverDSL(
|
|||||||
serverAddress: HostAndPort
|
serverAddress: HostAndPort
|
||||||
): Future<NodeMessagingClient> {
|
): Future<NodeMessagingClient> {
|
||||||
|
|
||||||
val nodeConfiguration = NodeConfigurationFromConfig(
|
val nodeConfiguration = FullNodeConfiguration(
|
||||||
NodeConfiguration.loadConfig(
|
NodeConfiguration.loadConfig(
|
||||||
baseDirectoryPath = Paths.get(baseDirectory, providedName),
|
baseDirectoryPath = Paths.get(baseDirectory, providedName),
|
||||||
allowMissingConfig = true,
|
allowMissingConfig = true,
|
||||||
@ -356,7 +355,7 @@ class DriverDSL(
|
|||||||
|
|
||||||
override fun startLocalServer(): Future<ArtemisMessagingServer> {
|
override fun startLocalServer(): Future<ArtemisMessagingServer> {
|
||||||
val name = "driver-local-server"
|
val name = "driver-local-server"
|
||||||
val config = NodeConfigurationFromConfig(
|
val config = FullNodeConfiguration(
|
||||||
NodeConfiguration.loadConfig(
|
NodeConfiguration.loadConfig(
|
||||||
baseDirectoryPath = Paths.get(baseDirectory, name),
|
baseDirectoryPath = Paths.get(baseDirectory, name),
|
||||||
allowMissingConfig = true,
|
allowMissingConfig = true,
|
||||||
|
@ -124,18 +124,6 @@ fun Config.getProperties(path: String): Properties {
|
|||||||
return props
|
return props
|
||||||
}
|
}
|
||||||
|
|
||||||
class NodeConfigurationFromConfig(val config: Config = ConfigFactory.load()) : NodeConfiguration {
|
|
||||||
override val basedir: Path by config
|
|
||||||
override val myLegalName: String by config
|
|
||||||
override val nearestCity: String by config
|
|
||||||
override val emailAddress: String by config
|
|
||||||
override val exportJMXto: String by config
|
|
||||||
override val keyStorePassword: String by config
|
|
||||||
override val trustStorePassword: String by config
|
|
||||||
override val dataSourceProperties: Properties by config
|
|
||||||
override val devMode: Boolean by config.getOrElse { false }
|
|
||||||
}
|
|
||||||
|
|
||||||
class FullNodeConfiguration(conf: Config) : NodeConfiguration {
|
class FullNodeConfiguration(conf: Config) : NodeConfiguration {
|
||||||
override val basedir: Path by conf
|
override val basedir: Path by conf
|
||||||
override val myLegalName: String by conf
|
override val myLegalName: String by conf
|
||||||
|
@ -9,8 +9,8 @@ import com.r3corda.core.crypto.X509Utilities.addOrReplaceKey
|
|||||||
import com.r3corda.core.div
|
import com.r3corda.core.div
|
||||||
import com.r3corda.core.minutes
|
import com.r3corda.core.minutes
|
||||||
import com.r3corda.core.utilities.loggerFor
|
import com.r3corda.core.utilities.loggerFor
|
||||||
|
import com.r3corda.node.services.config.FullNodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfiguration
|
import com.r3corda.node.services.config.NodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfigurationFromConfig
|
|
||||||
import com.r3corda.node.services.config.getValue
|
import com.r3corda.node.services.config.getValue
|
||||||
import joptsimple.OptionParser
|
import joptsimple.OptionParser
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
@ -131,7 +131,7 @@ fun main(args: Array<String>) {
|
|||||||
val configFile = if (cmdlineOptions.has(ParamsSpec.configFileArg)) Paths.get(cmdlineOptions.valueOf(ParamsSpec.configFileArg)) else null
|
val configFile = if (cmdlineOptions.has(ParamsSpec.configFileArg)) Paths.get(cmdlineOptions.valueOf(ParamsSpec.configFileArg)) else null
|
||||||
|
|
||||||
val config = NodeConfiguration.loadConfig(baseDirectoryPath, configFile, allowMissingConfig = true).let { config ->
|
val config = NodeConfiguration.loadConfig(baseDirectoryPath, configFile, allowMissingConfig = true).let { config ->
|
||||||
object : NodeConfiguration by NodeConfigurationFromConfig(config) {
|
object : NodeConfiguration by FullNodeConfiguration(config) {
|
||||||
val certificateSigningService: URL by config
|
val certificateSigningService: URL by config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ import com.r3corda.demos.utilities.putJson
|
|||||||
import com.r3corda.demos.utilities.uploadFile
|
import com.r3corda.demos.utilities.uploadFile
|
||||||
import com.r3corda.node.internal.AbstractNode
|
import com.r3corda.node.internal.AbstractNode
|
||||||
import com.r3corda.node.internal.Node
|
import com.r3corda.node.internal.Node
|
||||||
|
import com.r3corda.node.services.config.FullNodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfiguration
|
import com.r3corda.node.services.config.NodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfigurationFromConfig
|
|
||||||
import com.r3corda.node.services.messaging.NodeMessagingClient
|
import com.r3corda.node.services.messaging.NodeMessagingClient
|
||||||
import com.r3corda.node.services.network.NetworkMapService
|
import com.r3corda.node.services.network.NetworkMapService
|
||||||
import com.r3corda.node.services.transactions.SimpleNotaryService
|
import com.r3corda.node.services.transactions.SimpleNotaryService
|
||||||
@ -455,7 +455,7 @@ private fun loadConfigFile(baseDir: Path, configFile: Path, defaultLegalName: St
|
|||||||
createDefaultConfigFile(configFile, defaultLegalName)
|
createDefaultConfigFile(configFile, defaultLegalName)
|
||||||
log.warn("Default config created at $configFile.")
|
log.warn("Default config created at $configFile.")
|
||||||
}
|
}
|
||||||
return NodeConfigurationFromConfig(NodeConfiguration.loadConfig(baseDir, configFileOverride = configFile))
|
return FullNodeConfiguration(NodeConfiguration.loadConfig(baseDir, configFileOverride = configFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createIdentities(nodeConf: NodeConfiguration) {
|
private fun createIdentities(nodeConf: NodeConfiguration) {
|
||||||
|
@ -23,8 +23,8 @@ import com.r3corda.core.utilities.Emoji
|
|||||||
import com.r3corda.core.utilities.LogHelper
|
import com.r3corda.core.utilities.LogHelper
|
||||||
import com.r3corda.core.utilities.ProgressTracker
|
import com.r3corda.core.utilities.ProgressTracker
|
||||||
import com.r3corda.node.internal.Node
|
import com.r3corda.node.internal.Node
|
||||||
|
import com.r3corda.node.services.config.FullNodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfiguration
|
import com.r3corda.node.services.config.NodeConfiguration
|
||||||
import com.r3corda.node.services.config.NodeConfigurationFromConfig
|
|
||||||
import com.r3corda.node.services.messaging.NodeMessagingClient
|
import com.r3corda.node.services.messaging.NodeMessagingClient
|
||||||
import com.r3corda.node.services.network.NetworkMapService
|
import com.r3corda.node.services.network.NetworkMapService
|
||||||
import com.r3corda.node.services.persistence.NodeAttachmentService
|
import com.r3corda.node.services.persistence.NodeAttachmentService
|
||||||
@ -122,7 +122,7 @@ fun main(args: Array<String>) {
|
|||||||
Role.BUYER -> "Bank A"
|
Role.BUYER -> "Bank A"
|
||||||
Role.SELLER -> "Bank B"
|
Role.SELLER -> "Bank B"
|
||||||
}
|
}
|
||||||
NodeConfigurationFromConfig(NodeConfiguration.loadConfig(directory, allowMissingConfig = true, configOverrides = mapOf("myLegalName" to myLegalName)))
|
FullNodeConfiguration(NodeConfiguration.loadConfig(directory, allowMissingConfig = true, configOverrides = mapOf("myLegalName" to myLegalName)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Which services will this instance of the node provide to the network?
|
// Which services will this instance of the node provide to the network?
|
||||||
|
Loading…
Reference in New Issue
Block a user