Skip to content

Commit 2863f84

Browse files
authored
CORDA-1277 Remove double quotes from keys in reference.conf
CORDA-1277 Remove double quotes from keys in reference.conf
2 parents d2b7f8b + 91036ab commit 2863f84

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

docs/source/changelog.rst

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ from the previous milestone release.
3434

3535
* Introduced a placeholder for custom properties within ``node.conf``; the property key is "custom".
3636

37+
* Property keys with double quotes (e.g. `"key"`) in ``node.conf`` are no longer allowed, for rationale refer to :doc:`corda-configuration-file`.
38+
3739
* java.math.BigInteger serialization support added.
3840

3941
* java.security.cert.CRLReason added to the default Whitelist.

docs/source/corda-configuration-file.rst

+10-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ Format
2222
The Corda configuration file uses the HOCON format which is superset of JSON. Please visit
2323
`<https://github.com/typesafehub/config/blob/master/HOCON.md>`_ for further details.
2424

25+
Please do NOT use double quotes (``"``) in configuration keys.
26+
27+
Node setup will log `Config files should not contain \" in property names. Please fix: [key]` as error
28+
when it founds double quotes around keys.
29+
This prevents configuration errors when mixing keys containing ``.`` wrapped with double quotes and without them
30+
e.g.:
31+
The property `"dataSourceProperties.dataSourceClassName" = "val"` in ``reference.conf``
32+
would be not overwritten by the property `dataSourceProperties.dataSourceClassName = "val2"` in ``node.conf``.
33+
2534
Defaults
2635
--------
2736
A set of default configuration options are loaded from the built-in resource file ``/node/src/main/resources/reference.conf``.
@@ -261,4 +270,4 @@ Longer term these keys will be managed in secure hardware devices.
261270
:permissions: A list of permissions for starting flows via RPC. To give the user the permission to start the flow
262271
``foo.bar.FlowClass``, add the string ``StartFlow.foo.bar.FlowClass`` to the list. If the list
263272
contains the string ``ALL``, the user can start any flow via RPC. This value is intended for administrator
264-
users and for development.
273+
users and for development.

docs/source/example-code/src/main/resources/example-node.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ keyStorePassword : "cordacadevpass"
33
trustStorePassword : "trustpass"
44
dataSourceProperties : {
55
dataSourceClassName : org.h2.jdbcx.JdbcDataSource
6-
"dataSource.url" : "jdbc:h2:file:"${baseDirectory}"/persistence"
7-
"dataSource.user" : sa
8-
"dataSource.password" : ""
6+
dataSource.url : "jdbc:h2:file:"${baseDirectory}"/persistence"
7+
dataSource.user : sa
8+
dataSource.password : ""
99
}
1010
p2pAddress : "my-corda-node:10002"
1111
rpcSettings = {

node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt

+9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ object ConfigHelper {
3535
.withFallback(appConfig)
3636
.withFallback(defaultConfig)
3737
.resolve()
38+
39+
3840
log.info("Config:\n${finalConfig.root().render(ConfigRenderOptions.defaults())}")
41+
42+
val entrySet = finalConfig.entrySet().filter { entry -> entry.key.contains("\"") }
43+
for (mutableEntry in entrySet) {
44+
val key = mutableEntry.key
45+
log.error("Config files should not contain \" in property names. Please fix: ${key}")
46+
}
47+
3948
return finalConfig
4049
}
4150
}

node/src/main/resources/reference.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ keyStorePassword = "cordacadevpass"
44
trustStorePassword = "trustpass"
55
dataSourceProperties = {
66
dataSourceClassName = org.h2.jdbcx.JdbcDataSource
7-
"dataSource.url" = "jdbc:h2:file:"${baseDirectory}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT="${h2port}
8-
"dataSource.user" = sa
9-
"dataSource.password" = ""
7+
dataSource.url = "jdbc:h2:file:"${baseDirectory}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT="${h2port}
8+
dataSource.user = sa
9+
dataSource.password = ""
1010
}
1111
database = {
1212
transactionIsolationLevel = "REPEATABLE_READ"

0 commit comments

Comments
 (0)