diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 7c1abfc4f3..7e0bb6d299 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -34,6 +34,8 @@ from the previous milestone release. * Introduced a placeholder for custom properties within ``node.conf``; the property key is "custom". +* Property keys with double quotes (e.g. `"key"`) in ``node.conf`` are no longer allowed, for rationale refer to :doc:`corda-configuration-file`. + * java.math.BigInteger serialization support added. * java.security.cert.CRLReason added to the default Whitelist. diff --git a/docs/source/corda-configuration-file.rst b/docs/source/corda-configuration-file.rst index ffb1303440..e7eadde296 100644 --- a/docs/source/corda-configuration-file.rst +++ b/docs/source/corda-configuration-file.rst @@ -22,6 +22,15 @@ Format The Corda configuration file uses the HOCON format which is superset of JSON. Please visit ``_ for further details. +Please do NOT use double quotes (``"``) in configuration keys. + +Node setup will log `Config files should not contain \" in property names. Please fix: [key]` as error +when it founds double quotes around keys. +This prevents configuration errors when mixing keys containing ``.`` wrapped with double quotes and without them +e.g.: +The property `"dataSourceProperties.dataSourceClassName" = "val"` in ``reference.conf`` +would be not overwritten by the property `dataSourceProperties.dataSourceClassName = "val2"` in ``node.conf``. + Defaults -------- A set of default configuration options are loaded from the built-in resource file ``/node/src/main/resources/reference.conf``. @@ -286,4 +295,4 @@ Longer term these keys will be managed in secure hardware devices. :permissions: A list of permissions for starting flows via RPC. To give the user the permission to start the flow ``foo.bar.FlowClass``, add the string ``StartFlow.foo.bar.FlowClass`` to the list. If the list contains the string ``ALL``, the user can start any flow via RPC. This value is intended for administrator - users and for development. \ No newline at end of file + users and for development. diff --git a/docs/source/example-code/src/main/resources/example-node.conf b/docs/source/example-code/src/main/resources/example-node.conf index 06e9fae078..48595226ab 100644 --- a/docs/source/example-code/src/main/resources/example-node.conf +++ b/docs/source/example-code/src/main/resources/example-node.conf @@ -3,9 +3,9 @@ keyStorePassword : "cordacadevpass" trustStorePassword : "trustpass" dataSourceProperties : { dataSourceClassName : org.h2.jdbcx.JdbcDataSource - "dataSource.url" : "jdbc:h2:file:"${baseDirectory}"/persistence" - "dataSource.user" : sa - "dataSource.password" : "" + dataSource.url : "jdbc:h2:file:"${baseDirectory}"/persistence" + dataSource.user : sa + dataSource.password : "" } p2pAddress : "my-corda-node:10002" rpcSettings = { diff --git a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt index 9307205dea..97eee02aed 100644 --- a/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt +++ b/node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt @@ -58,7 +58,16 @@ object ConfigHelper { .withFallback(appConfig) .withFallback(defaultConfig) .resolve() + + log.info("Config:\n${finalConfig.root().render(ConfigRenderOptions.defaults())}") + + val entrySet = finalConfig.entrySet().filter { entry -> entry.key.contains("\"") } + for (mutableEntry in entrySet) { + val key = mutableEntry.key + log.error("Config files should not contain \" in property names. Please fix: ${key}") + } + return finalConfig }