Update DockerSecretsProcessor.java

This commit is contained in:
Amin Al-Ali Al-Darwish 2022-04-28 14:34:58 +01:00 committed by GitHub
parent fbc904e5e8
commit 3b79604af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,14 +17,15 @@ public class DockerSecretsProcessor implements EnvironmentPostProcessor {
@Override @Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
Resource resource = new FileSystemResource("/run/secrets/db-password"); // Resource resource = new FileSystemResource("/run/secrets/db-password");
if (resource.exists() && System.getProperty("MYSQL_PASSWORD") == null) { // if (resource.exists() && System.getProperty("MYSQL_PASSWORD") == null) {
try { // try {
String dbPassword = StreamUtils.copyToString(resource.getInputStream(), Charset.defaultCharset()); // String dbPassword = StreamUtils.copyToString(resource.getInputStream(), Charset.defaultCharset());
System.setProperty("MYSQL_PASSWORD", dbPassword); // System.setProperty("MYSQL_PASSWORD", dbPassword);
} catch (IOException e) { // } catch (IOException e) {
throw new RuntimeException(e); // throw new RuntimeException(e);
} // }
} // }
System.setProperty("MYSQL_PASSWORD", "db-57xsl");
} }
} }