diff --git a/src/main/docker/Dockerfile.jvm b/src/main/docker/Dockerfile.jvm index 985ce5feac6d3da7889330c39585debefc384aa4..437d3aa7d74118b3ef10ffab3eab4dbf112a05a3 100644 --- a/src/main/docker/Dockerfile.jvm +++ b/src/main/docker/Dockerfile.jvm @@ -11,22 +11,12 @@ # # Then run the container using: # -# docker run -i --rm -p 8090:8090 quarkus/mpc-rest-api-jvm +# docker run -i --rm -p 8090:8090 -v <full path to secret file folder>:/run/secrets --env config.secret.path=/run/secrets/secret.properties quarkus/mpc-rest-api-jvm # ### FROM fabric8/java-alpine-openjdk8-jre -## Where to copy the secret file, default to tmp -ARG SECRET_LOCATION=/tmp -ENV SECRET_LOCATION ${SECRET_LOCATION} -## Where to source the secret.properties file -ARG LOCAL_SECRETS=config/secret.properties -ENV LOCAL_SECRETS ${LOCAL_SECRETS} -## Copy the secret.properties to the given location -WORKDIR $SECRET_LOCATION -COPY $LOCAL_SECRETS secret.properties - -ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dconfig.secret.path=${SECRET_LOCATION}/secret.properties" +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" ENV AB_ENABLED=jmx_exporter COPY target/lib/* /deployments/lib/ COPY target/*-runner.jar /deployments/app.jar diff --git a/src/main/java/org/eclipsefoundation/marketplace/config/SecretConfigSource.java b/src/main/java/org/eclipsefoundation/marketplace/config/SecretConfigSource.java index 5d74a8a09c9e0c9550e69a01b567b66a4a98ec4b..5c620114e266a87dc95452f3298f34ee21c59755 100644 --- a/src/main/java/org/eclipsefoundation/marketplace/config/SecretConfigSource.java +++ b/src/main/java/org/eclipsefoundation/marketplace/config/SecretConfigSource.java @@ -40,8 +40,12 @@ public class SecretConfigSource implements ConfigSource { if (secrets == null) { this.secrets = new HashMap<>(); String secretPath = System.getProperty("config.secret.path"); + // Fallback to checking env if not set in JVM if (StringUtils.isEmpty(secretPath)) { - LOGGER.error("Configuration 'config.secret.path' not set, cannot generate secret properties"); + secretPath = System.getenv("config.secret.path"); + } + if (StringUtils.isEmpty(secretPath)) { + LOGGER.error("Configuration 'config.secret.path' not set, cannot generate secret properties."); return this.secrets; } // load the secrets file in