File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
config/src/main/java/com/typesafe/config Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -496,6 +496,7 @@ public static void invalidateCaches() {
496496 // We rely on this having the side effect that it drops
497497 // all caches
498498 ConfigImpl .reloadSystemPropertiesConfig ();
499+ ConfigImpl .reloadEnvVariablesConfig ();
499500 }
500501
501502 /**
Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ private static AbstractConfigObject loadEnvVariables() {
339339 }
340340
341341 private static class EnvVariablesHolder {
342- static final AbstractConfigObject envVariables = loadEnvVariables ();
342+ static volatile AbstractConfigObject envVariables = loadEnvVariables ();
343343 }
344344
345345 static AbstractConfigObject envVariablesAsConfigObject () {
@@ -354,6 +354,12 @@ public static Config envVariablesAsConfig() {
354354 return envVariablesAsConfigObject ().toConfig ();
355355 }
356356
357+ public static void reloadEnvVariablesConfig () {
358+ // ConfigFactory.invalidateCaches() relies on this having the side
359+ // effect that it drops all caches
360+ EnvVariablesHolder .envVariables = loadEnvVariables ();
361+ }
362+
357363 public static Config defaultReference (final ClassLoader loader ) {
358364 return computeCachedConfig (loader , "defaultReference" , new Callable <Config >() {
359365 @ Override
You can’t perform that action at this time.
0 commit comments