Skip to content

Commit

Permalink
Do not allow empty env vars (#5983)
Browse files Browse the repository at this point in the history
Fixes #5026 

Signed-off-by: Priyambada Roul <[email protected]>
  • Loading branch information
roulpriya authored Oct 10, 2022
1 parent 09c42a4 commit 914769f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ private String getConfigurable(
}

if (environment.containsKey(envVarName)) {
return environment.get(envVarName);
String value = environment.get(envVarName);
if (!value.isEmpty()) {
return value;
}
}

for (final Properties properties : propertiesSources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public void shouldReadDockerSettingsFromUserProperties() {
.isEqualTo("some value");
}

@Test
public void shouldNotReadSettingIfCorrespondingEnvironmentVarIsEmptyString() {
environment.put("DOCKER_FOO", "");
assertThat(newConfig().getEnvVarOrUserProperty("docker.foo", "default"))
.as("reads unprefixed env vars for docker. settings")
.isEqualTo("default");
}

@Test
public void shouldNotReadDockerClientStrategyFromClasspathProperties() {
String currentValue = newConfig().getDockerClientStrategyClassName();
Expand Down

0 comments on commit 914769f

Please sign in to comment.