
io.scalecube.config.source.SystemEnvironmentConfigSource Maven / Gradle / Ivy
package io.scalecube.config.source;
import io.scalecube.config.ConfigProperty;
import java.util.Map;
import java.util.TreeMap;
public final class SystemEnvironmentConfigSource implements ConfigSource {
private Map loadedConfig;
@Override
public Map loadConfig() {
if (loadedConfig != null) {
return loadedConfig;
}
Map env = System.getenv();
Map result = new TreeMap<>();
for (Map.Entry entry : env.entrySet()) {
String propName = entry.getKey();
result.put(propName, LoadedConfigProperty.forNameAndValue(propName, entry.getValue()));
}
return loadedConfig = result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy