mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
[EG-140] Allow system property paths with multiple keys to be specified in node.conf (#5963)
* [EG-140] Allow system property paths with multiple keys to be specified in node.conf * [EG-140] Split property paths to remove quotes * [EG-140] Quote system properties in docs * [EG-140] Rename path to key
This commit is contained in:
parent
84be738374
commit
da192bcf0d
@ -643,7 +643,7 @@ sshd
|
|||||||
|
|
||||||
systemProperties
|
systemProperties
|
||||||
An optional map of additional system properties to be set when launching via ``corda.jar`` only.
|
An optional map of additional system properties to be set when launching via ``corda.jar`` only.
|
||||||
Keys and values of the map should be strings. e.g. ``systemProperties = { visualvm.display.name = FooBar }``
|
Keys and values of the map should be strings. e.g. ``systemProperties = { "visualvm.display.name" = FooBar }``
|
||||||
|
|
||||||
*Default:* not defined
|
*Default:* not defined
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import java.util.jar.JarInputStream;
|
|||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static com.typesafe.config.ConfigUtil.splitPath;
|
||||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||||
import static java.util.stream.Collectors.toMap;
|
import static java.util.stream.Collectors.toMap;
|
||||||
|
|
||||||
@ -233,7 +234,6 @@ public class CordaCaplet extends Capsule {
|
|||||||
try {
|
try {
|
||||||
Map<String, ?> overrideSystemProps = nodeConfig.getConfig("systemProperties").entrySet().stream()
|
Map<String, ?> overrideSystemProps = nodeConfig.getConfig("systemProperties").entrySet().stream()
|
||||||
.map(Property::create)
|
.map(Property::create)
|
||||||
.filter(Property::isValid)
|
|
||||||
.collect(toMap(Property::getKey, Property::getValue));
|
.collect(toMap(Property::getKey, Property::getValue));
|
||||||
log(LOG_VERBOSE, "Configured system properties = " + overrideSystemProps);
|
log(LOG_VERBOSE, "Configured system properties = " + overrideSystemProps);
|
||||||
for (Map.Entry<String, ?> entry : overrideSystemProps.entrySet()) {
|
for (Map.Entry<String, ?> entry : overrideSystemProps.entrySet()) {
|
||||||
@ -321,20 +321,16 @@ public class CordaCaplet extends Capsule {
|
|||||||
* Helper class so that we can parse the "systemProperties" element of node.conf.
|
* Helper class so that we can parse the "systemProperties" element of node.conf.
|
||||||
*/
|
*/
|
||||||
private static class Property {
|
private static class Property {
|
||||||
private final List<String> path;
|
private final String key;
|
||||||
private final Object value;
|
private final Object value;
|
||||||
|
|
||||||
Property(List<String> path, Object value) {
|
Property(String key, Object value) {
|
||||||
this.path = path;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isValid() {
|
|
||||||
return path.size() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getKey() {
|
String getKey() {
|
||||||
return path.get(0);
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object getValue() {
|
Object getValue() {
|
||||||
@ -342,7 +338,12 @@ public class CordaCaplet extends Capsule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Property create(Map.Entry<String, ConfigValue> entry) {
|
static Property create(Map.Entry<String, ConfigValue> entry) {
|
||||||
return new Property(ConfigUtil.splitPath(entry.getKey()), entry.getValue().unwrapped());
|
// String.join is preferred here over Typesafe's joinPath method, as the joinPath method would put quotes around the system
|
||||||
|
// property key which is undesirable here.
|
||||||
|
return new Property(
|
||||||
|
String.join(".", splitPath(entry.getKey())),
|
||||||
|
entry.getValue().unwrapped()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user