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
|
||||
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
|
||||
|
||||
|
@ -17,6 +17,7 @@ import java.util.jar.JarInputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.typesafe.config.ConfigUtil.splitPath;
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
@ -233,7 +234,6 @@ public class CordaCaplet extends Capsule {
|
||||
try {
|
||||
Map<String, ?> overrideSystemProps = nodeConfig.getConfig("systemProperties").entrySet().stream()
|
||||
.map(Property::create)
|
||||
.filter(Property::isValid)
|
||||
.collect(toMap(Property::getKey, Property::getValue));
|
||||
log(LOG_VERBOSE, "Configured system properties = " + overrideSystemProps);
|
||||
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.
|
||||
*/
|
||||
private static class Property {
|
||||
private final List<String> path;
|
||||
private final String key;
|
||||
private final Object value;
|
||||
|
||||
Property(List<String> path, Object value) {
|
||||
this.path = path;
|
||||
Property(String key, Object value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
boolean isValid() {
|
||||
return path.size() == 1;
|
||||
}
|
||||
|
||||
String getKey() {
|
||||
return path.get(0);
|
||||
return key;
|
||||
}
|
||||
|
||||
Object getValue() {
|
||||
@ -342,7 +338,12 @@ public class CordaCaplet extends Capsule {
|
||||
}
|
||||
|
||||
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