mirror of
https://github.com/lightbend/config.git
synced 2025-02-11 12:00:08 +08:00
Fix: Avoid loading all the environment variables as configurations when override_with_env_vars = true
This commit is contained in:
parent
44f21c31b9
commit
379a1f056c
@ -371,7 +371,7 @@ public class ConfigImpl {
|
|||||||
|
|
||||||
private static AbstractConfigObject loadEnvVariablesOverrides() {
|
private static AbstractConfigObject loadEnvVariablesOverrides() {
|
||||||
Map<String, String> env = new HashMap(System.getenv());
|
Map<String, String> env = new HashMap(System.getenv());
|
||||||
Map<String, String> result = new HashMap(System.getenv());
|
Map<String, String> result = new HashMap();
|
||||||
|
|
||||||
for (String key : env.keySet()) {
|
for (String key : env.keySet()) {
|
||||||
if (key.startsWith(ENV_VAR_OVERRIDE_PREFIX)) {
|
if (key.startsWith(ENV_VAR_OVERRIDE_PREFIX)) {
|
||||||
|
@ -1135,6 +1135,10 @@ class ConfigTest extends TestUtils {
|
|||||||
assertEquals(3, conf02.getInt("a-c"))
|
assertEquals(3, conf02.getInt("a-c"))
|
||||||
assertEquals(4, conf02.getInt("a_c"))
|
assertEquals(4, conf02.getInt("a_c"))
|
||||||
|
|
||||||
|
intercept[ConfigException.Missing] {
|
||||||
|
conf02.getInt("CONFIG_FORCE_a_b_c")
|
||||||
|
}
|
||||||
|
|
||||||
assertEquals("foo", conf04.getString("akka.version"))
|
assertEquals("foo", conf04.getString("akka.version"))
|
||||||
assertEquals(10, conf04.getInt("akka.event-handler-dispatcher.max-pool-size"))
|
assertEquals(10, conf04.getInt("akka.event-handler-dispatcher.max-pool-size"))
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user