Skip to content

Commit 2015fae

Browse files
committed
Add "yes" as a positive value for ALLOW_EMPTY_PASSWORD in bitnami/clickhouse
Signed-off-by: He Zean <realhezean@gmail.com>
1 parent 8039030 commit 2015fae

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/service/connection/clickhouse/ClickHouseEnvironment.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,7 +41,8 @@ class ClickHouseEnvironment {
4141
}
4242

4343
private String extractPassword(Map<String, String> env) {
44-
boolean allowEmpty = Boolean.parseBoolean(env.getOrDefault("ALLOW_EMPTY_PASSWORD", Boolean.FALSE.toString()));
44+
boolean allowEmpty = "true".equalsIgnoreCase(env.get("ALLOW_EMPTY_PASSWORD"))
45+
|| "yes".equalsIgnoreCase(env.get("ALLOW_EMPTY_PASSWORD"));
4546
String password = env.get("CLICKHOUSE_PASSWORD");
4647
Assert.state(StringUtils.hasLength(password) || allowEmpty, "No ClickHouse password found");
4748
return (password != null) ? password : "";

spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/clickhouse/ClickHouseEnvironmentTests.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,6 +49,12 @@ void getPasswordWhenHasNoPasswordAndAllowEmptyPassword() {
4949
assertThat(environment.getPassword()).isEmpty();
5050
}
5151

52+
@Test
53+
void getPasswordWhenHasNoPasswordAndAllowEmptyPasswordIsYes() {
54+
ClickHouseEnvironment environment = new ClickHouseEnvironment(Map.of("ALLOW_EMPTY_PASSWORD", "yes"));
55+
assertThat(environment.getPassword()).isEmpty();
56+
}
57+
5258
@Test
5359
void getPasswordWhenHasNoPasswordAndAllowEmptyPasswordIsFalse() {
5460
assertThatIllegalStateException()

0 commit comments

Comments
 (0)