mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
CORDA-3578 add corda prefix to conf file names as original issue was … (#6322)
* CORDA-3578 add corda prefix to conf file names as original issue was having non-corda reference.conf files on classpath causes DriverDSLImp failure it is better to have this naming convention and avoid further conflicts of conf files. * fixed weird duplicates * revert renaming changes for web-reference.conf and loadtest-reference.conf
This commit is contained in:
parent
2a2f04e568
commit
26d4bfb89f
@ -51,7 +51,7 @@ class ConfigExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Config.parseAsNodeConfigWithFallback(): Validated<NodeConfiguration, Configuration.Validation.Error> {
|
fun Config.parseAsNodeConfigWithFallback(): Validated<NodeConfiguration, Configuration.Validation.Error> {
|
||||||
val referenceConfig = ConfigFactory.parseResources("reference.conf")
|
val referenceConfig = ConfigFactory.parseResources("corda-reference.conf")
|
||||||
val nodeConfig = this
|
val nodeConfig = this
|
||||||
.withValue("baseDirectory", ConfigValueFactory.fromAnyRef("/opt/corda"))
|
.withValue("baseDirectory", ConfigValueFactory.fromAnyRef("/opt/corda"))
|
||||||
.withFallback(referenceConfig)
|
.withFallback(referenceConfig)
|
||||||
|
@ -51,7 +51,7 @@ task buildCordaJAR(type: FatCapsule, dependsOn: [
|
|||||||
applicationSource = files(
|
applicationSource = files(
|
||||||
nodeProject.configurations.runtimeClasspath,
|
nodeProject.configurations.runtimeClasspath,
|
||||||
nodeProject.tasks.jar,
|
nodeProject.tasks.jar,
|
||||||
nodeProject.buildDir.toString() + '/resources/main/reference.conf',
|
nodeProject.buildDir.toString() + '/resources/main/corda-reference.conf',
|
||||||
"$rootDir/config/dev/log4j2.xml",
|
"$rootDir/config/dev/log4j2.xml",
|
||||||
'NOTICE' // Copy CDDL notice
|
'NOTICE' // Copy CDDL notice
|
||||||
)
|
)
|
||||||
|
@ -37,7 +37,7 @@ public class CordaCaplet extends Capsule {
|
|||||||
File configFile = (config == null) ? new File(baseDir, "node.conf") : new File(config);
|
File configFile = (config == null) ? new File(baseDir, "node.conf") : new File(config);
|
||||||
try {
|
try {
|
||||||
ConfigParseOptions parseOptions = ConfigParseOptions.defaults().setAllowMissing(false);
|
ConfigParseOptions parseOptions = ConfigParseOptions.defaults().setAllowMissing(false);
|
||||||
Config defaultConfig = ConfigFactory.parseResources("reference.conf", parseOptions);
|
Config defaultConfig = ConfigFactory.parseResources("corda-reference.conf", parseOptions);
|
||||||
Config baseDirectoryConfig = ConfigFactory.parseMap(Collections.singletonMap("baseDirectory", baseDir));
|
Config baseDirectoryConfig = ConfigFactory.parseMap(Collections.singletonMap("baseDirectory", baseDir));
|
||||||
Config nodeConfig = ConfigFactory.parseFile(configFile, parseOptions);
|
Config nodeConfig = ConfigFactory.parseFile(configFile, parseOptions);
|
||||||
return baseDirectoryConfig.withFallback(nodeConfig).withFallback(defaultConfig).resolve();
|
return baseDirectoryConfig.withFallback(nodeConfig).withFallback(defaultConfig).resolve();
|
||||||
|
@ -42,7 +42,7 @@ object ConfigHelper {
|
|||||||
allowMissingConfig: Boolean = false,
|
allowMissingConfig: Boolean = false,
|
||||||
configOverrides: Config = ConfigFactory.empty()): Config {
|
configOverrides: Config = ConfigFactory.empty()): Config {
|
||||||
val parseOptions = ConfigParseOptions.defaults()
|
val parseOptions = ConfigParseOptions.defaults()
|
||||||
val defaultConfig = ConfigFactory.parseResources("reference.conf", parseOptions.setAllowMissing(false))
|
val defaultConfig = ConfigFactory.parseResources("corda-reference.conf", parseOptions.setAllowMissing(false))
|
||||||
val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig))
|
val appConfig = ConfigFactory.parseFile(configFile.toFile(), parseOptions.setAllowMissing(allowMissingConfig))
|
||||||
|
|
||||||
// Detect the underlying OS. If mac or windows non-server then we assume we're running in devMode. Unless specified otherwise.
|
// Detect the underlying OS. If mac or windows non-server then we assume we're running in devMode. Unless specified otherwise.
|
||||||
|
@ -27,7 +27,7 @@ public class CordaWebserverCaplet extends Capsule {
|
|||||||
File configFile = (config == null) ? new File(baseDir, "node.conf") : new File(config);
|
File configFile = (config == null) ? new File(baseDir, "node.conf") : new File(config);
|
||||||
try {
|
try {
|
||||||
ConfigParseOptions parseOptions = ConfigParseOptions.defaults().setAllowMissing(false);
|
ConfigParseOptions parseOptions = ConfigParseOptions.defaults().setAllowMissing(false);
|
||||||
Config defaultConfig = ConfigFactory.parseResources("reference.conf", parseOptions);
|
Config defaultConfig = ConfigFactory.parseResources("corda-reference.conf", parseOptions);
|
||||||
Config baseDirectoryConfig = ConfigFactory.parseMap(Collections.singletonMap("baseDirectory", baseDir));
|
Config baseDirectoryConfig = ConfigFactory.parseMap(Collections.singletonMap("baseDirectory", baseDir));
|
||||||
Config nodeConfig = ConfigFactory.parseFile(configFile, parseOptions);
|
Config nodeConfig = ConfigFactory.parseFile(configFile, parseOptions);
|
||||||
return baseDirectoryConfig.withFallback(nodeConfig).withFallback(defaultConfig).resolve();
|
return baseDirectoryConfig.withFallback(nodeConfig).withFallback(defaultConfig).resolve();
|
||||||
|
@ -35,7 +35,7 @@ task buildWebserverJar(type: FatCapsule, dependsOn: project(':node').tasks.jar)
|
|||||||
project(':testing:testserver').tasks.jar,
|
project(':testing:testserver').tasks.jar,
|
||||||
project(':testing:testserver').sourceSets.main.java.outputDir.toString() + '/CordaWebserverCaplet.class',
|
project(':testing:testserver').sourceSets.main.java.outputDir.toString() + '/CordaWebserverCaplet.class',
|
||||||
project(':testing:testserver').sourceSets.main.java.outputDir.toString() + '/CordaWebserverCaplet$1.class',
|
project(':testing:testserver').sourceSets.main.java.outputDir.toString() + '/CordaWebserverCaplet$1.class',
|
||||||
project(':node').buildDir.toString() + '/resources/main/reference.conf',
|
project(':node').buildDir.toString() + '/resources/main/corda-reference.conf',
|
||||||
"$rootDir/config/dev/log4j2.xml",
|
"$rootDir/config/dev/log4j2.xml",
|
||||||
project(':node:capsule').projectDir.toString() + '/NOTICE' // Copy CDDL notice
|
project(':node:capsule').projectDir.toString() + '/NOTICE' // Copy CDDL notice
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@ import java.nio.file.StandardCopyOption
|
|||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a subset of FullNodeConfiguration, containing only those configs which we need. The node uses reference.conf
|
* This is a subset of FullNodeConfiguration, containing only those configs which we need. The node uses corda-reference.conf
|
||||||
* to fill in the defaults so we're not required to specify them here.
|
* to fill in the defaults so we're not required to specify them here.
|
||||||
*/
|
*/
|
||||||
data class NodeConfig(
|
data class NodeConfig(
|
||||||
|
@ -37,7 +37,7 @@ class NodeConfigTest {
|
|||||||
|
|
||||||
val nodeConfig = config.nodeConf()
|
val nodeConfig = config.nodeConf()
|
||||||
.withValue("baseDirectory", valueFor(baseDir.toString()))
|
.withValue("baseDirectory", valueFor(baseDir.toString()))
|
||||||
.withFallback(ConfigFactory.parseResources("reference.conf"))
|
.withFallback(ConfigFactory.parseResources("corda-reference.conf"))
|
||||||
.withFallback(ConfigFactory.parseMap(mapOf("devMode" to true)))
|
.withFallback(ConfigFactory.parseMap(mapOf("devMode" to true)))
|
||||||
.resolve()
|
.resolve()
|
||||||
val fullConfig = nodeConfig.parseAsNodeConfiguration().value()
|
val fullConfig = nodeConfig.parseAsNodeConfiguration().value()
|
||||||
@ -70,7 +70,7 @@ class NodeConfigTest {
|
|||||||
.withValue("systemProperties", valueFor(mapOf("property.name" to "value")))
|
.withValue("systemProperties", valueFor(mapOf("property.name" to "value")))
|
||||||
.withValue("custom.jvmArgs", valueFor("-Xmx1000G"))
|
.withValue("custom.jvmArgs", valueFor("-Xmx1000G"))
|
||||||
.withValue("baseDirectory", valueFor(baseDir.toString()))
|
.withValue("baseDirectory", valueFor(baseDir.toString()))
|
||||||
.withFallback(ConfigFactory.parseResources("reference.conf"))
|
.withFallback(ConfigFactory.parseResources("corda-reference.conf"))
|
||||||
.withFallback(ConfigFactory.parseMap(mapOf("devMode" to true)))
|
.withFallback(ConfigFactory.parseMap(mapOf("devMode" to true)))
|
||||||
.resolve()
|
.resolve()
|
||||||
val fullConfig = nodeConfig.parseAsNodeConfiguration().value()
|
val fullConfig = nodeConfig.parseAsNodeConfiguration().value()
|
||||||
|
@ -63,7 +63,7 @@ open class NodeBuilder {
|
|||||||
fun Config.parseAsNodeConfigWithFallback(preCopyConfig: Config): Validated<NodeConfiguration, Configuration.Validation.Error> {
|
fun Config.parseAsNodeConfigWithFallback(preCopyConfig: Config): Validated<NodeConfiguration, Configuration.Validation.Error> {
|
||||||
val nodeConfig = this
|
val nodeConfig = this
|
||||||
.withValue("baseDirectory", ConfigValueFactory.fromAnyRef(""))
|
.withValue("baseDirectory", ConfigValueFactory.fromAnyRef(""))
|
||||||
.withFallback(ConfigFactory.parseResources("reference.conf"))
|
.withFallback(ConfigFactory.parseResources("corda-reference.conf"))
|
||||||
.withFallback(preCopyConfig)
|
.withFallback(preCopyConfig)
|
||||||
.resolve()
|
.resolve()
|
||||||
return nodeConfig.parseAsNodeConfiguration()
|
return nodeConfig.parseAsNodeConfiguration()
|
||||||
|
Loading…
Reference in New Issue
Block a user