mirror of
https://github.com/lightbend/config.git
synced 2025-03-24 08:10:24 +08:00
Merge pull request #464 from camullen/master
ConfigFactory.invalidateCaches() also resets environment variables cache
This commit is contained in:
commit
7a58c2e6a2
config/src/main/java/com/typesafe/config
@ -496,6 +496,7 @@ public final class ConfigFactory {
|
||||
// We rely on this having the side effect that it drops
|
||||
// all caches
|
||||
ConfigImpl.reloadSystemPropertiesConfig();
|
||||
ConfigImpl.reloadEnvVariablesConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,7 +339,7 @@ public class ConfigImpl {
|
||||
}
|
||||
|
||||
private static class EnvVariablesHolder {
|
||||
static final AbstractConfigObject envVariables = loadEnvVariables();
|
||||
static volatile AbstractConfigObject envVariables = loadEnvVariables();
|
||||
}
|
||||
|
||||
static AbstractConfigObject envVariablesAsConfigObject() {
|
||||
@ -354,6 +354,12 @@ public class ConfigImpl {
|
||||
return envVariablesAsConfigObject().toConfig();
|
||||
}
|
||||
|
||||
public static void reloadEnvVariablesConfig() {
|
||||
// ConfigFactory.invalidateCaches() relies on this having the side
|
||||
// effect that it drops all caches
|
||||
EnvVariablesHolder.envVariables = loadEnvVariables();
|
||||
}
|
||||
|
||||
public static Config defaultReference(final ClassLoader loader) {
|
||||
return computeCachedConfig(loader, "defaultReference", new Callable<Config>() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user