Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return default for empty environment variable #5983

Merged
merged 1 commit into from Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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