use of io.georocket.constants.ConfigConstants in project georocket by georocket.
the class GeoRocket method overwriteWithEnvironmentVariables.
/**
* Match every environment variable against the config keys from
* {{@link ConfigConstants#getConfigKeys()}} and save the found values using
* the config key in the config object.
* @param conf the config object
* @param env the map with the environment variables
*/
static void overwriteWithEnvironmentVariables(JsonObject conf, Map<String, String> env) {
Map<String, String> names = ConfigConstants.getConfigKeys().stream().collect(Collectors.toMap(s -> s.toUpperCase().replace(".", "_"), Function.identity()));
env.forEach((key, val) -> {
String name = names.get(key.toUpperCase());
if (name != null) {
Object newVal = toJsonType(val);
conf.put(name, newVal);
}
});
}
Aggregations