diff --git a/dictionaryweights/Dockerfile b/dictionaryweights/Dockerfile index 5bab457..cc88383 100644 --- a/dictionaryweights/Dockerfile +++ b/dictionaryweights/Dockerfile @@ -13,4 +13,13 @@ FROM amazoncorretto:22-alpine # Copy jar and access token from maven build COPY --from=build target/dictionaryweights-*.jar /dictionaryweights.jar -ENTRYPOINT java -jar /dictionaryweights.jar \ No newline at end of file +ARG DATASOURCE_URL +ARG DATASOURCE_USERNAME +ARG SPRING_PROFILE + +# If a --env-file is passed in, you can override these values +ENV DATASOURCE_URL=${DATASOURCE_URL} +ENV DATASOURCE_USERNAME=${DATASOURCE_USERNAME} +ENV SPRING_PROFILE=${SPRING_PROFILE} + +ENTRYPOINT java -jar /dictionaryweights.jar --spring.profiles.active=${SPRING_PROFILE:-} \ No newline at end of file diff --git a/dictionaryweights/pom.xml b/dictionaryweights/pom.xml index 9bc2280..5294e33 100644 --- a/dictionaryweights/pom.xml +++ b/dictionaryweights/pom.xml @@ -61,6 +61,11 @@ postgresql test + + com.amazonaws.secretsmanager + aws-secretsmanager-jdbc + 2.0.2 + diff --git a/dictionaryweights/src/main/resources/application-bdc.properties b/dictionaryweights/src/main/resources/application-bdc.properties index c0f75a9..5ecc746 100644 --- a/dictionaryweights/src/main/resources/application-bdc.properties +++ b/dictionaryweights/src/main/resources/application-bdc.properties @@ -1,9 +1,9 @@ spring.application.name=dictionaryweights spring.main.web-application-type=none -spring.datasource.url=jdbc:postgresql://${POSTGRES_HOST}:5432/dict?currentSchema=dict -spring.datasource.username=${POSTGRES_USER} -spring.datasource.password=${POSTGRES_PASSWORD} -spring.datasource.driver-class-name=org.postgresql.Driver +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.datasource.driver-class-name=com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver +spring.datasource.url=jdbc-secretsmanager:postgresql://${DATASOURCE_URL}/dict?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true +spring.datasource.username=${DATASOURCE_USERNAME} weights.filename=/weights.csv \ No newline at end of file