From 6585fdd85f7f79f6a7bfaef6a8c6ae3d98dfe935 Mon Sep 17 00:00:00 2001 From: Felix Dittrich <31076102+f11h@users.noreply.github.com> Date: Fri, 28 May 2021 14:27:46 +0200 Subject: [PATCH] Add a workaround to load DB Enc PW from System Property (#286) --- .../federationgateway/config/EfgsProperties.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java b/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java index 453ea06..3f11c58 100644 --- a/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java +++ b/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java @@ -21,6 +21,7 @@ package eu.interop.federationgateway.config; import java.util.List; +import javax.annotation.PostConstruct; import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -30,6 +31,8 @@ @ConfigurationProperties("efgs") public class EfgsProperties { + private static final String PASSWORD_PROPERTY_NAME = "efgs_dbencryption_password"; + private final ContentNegotiation contentNegotiation = new ContentNegotiation(); private final UploadSettings uploadSettings = new UploadSettings(); private final DownloadSettings downloadSettings = new DownloadSettings(); @@ -113,4 +116,14 @@ public static class HeaderFields { public static class DbEncryption { private String password; } + + /** + * Workaround to load DB Encryption Password from System Property until environment is setup correctly. + */ + @PostConstruct + public void workaround() { + if (System.getProperties().containsKey(PASSWORD_PROPERTY_NAME)) { + dbEncryption.setPassword(System.getProperty(PASSWORD_PROPERTY_NAME)); + } + } }