diff --git a/Dockerfile b/Dockerfile
index 1a441e0..457f53e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,5 +16,14 @@ COPY --from=build target/dictionary-*.jar /dictionary.jar
# Time zone
ENV TZ="US/Eastern"
+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}
+
# Default to no profile
-ENTRYPOINT java $DEBUG_VARS $PROXY_VARS -Xmx8192m -jar /dictionary.jar --spring.profiles.active=${SPRING_PROFILE:-}
+ENTRYPOINT java $DEBUG_VARS $PROXY_VARS -Xmx8192m -jar /dictionary.jar --spring.profiles.active=${SPRING_PROFILE:-}
\ No newline at end of file
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/java/edu/harvard/dbmi/avillach/dictionaryweights/DataSourceVerifier.java b/dictionaryweights/src/main/java/edu/harvard/dbmi/avillach/dictionaryweights/DataSourceVerifier.java
new file mode 100644
index 0000000..9e36308
--- /dev/null
+++ b/dictionaryweights/src/main/java/edu/harvard/dbmi/avillach/dictionaryweights/DataSourceVerifier.java
@@ -0,0 +1,39 @@
+package edu.harvard.dbmi.avillach.dictionary.datasource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.stereotype.Service;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+@Service
+public class DataSourceVerifier {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DataSourceVerifier.class);
+
+ private final DataSource dataSource;
+
+ @Autowired
+ public DataSourceVerifier(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ @EventListener(ContextRefreshedEvent.class)
+ public void verifyDataSourceConnection() {
+ try (Connection connection = dataSource.getConnection()) {
+ if (connection != null) {
+ LOG.info("Datasource connection verified successfully.");
+ } else {
+ LOG.info("Failed to obtain a connection from the datasource.");
+ }
+ } catch (SQLException e) {
+ LOG.info("Error verifying datasource connection: {}", e.getMessage());
+ }
+ }
+
+}
diff --git a/dictionaryweights/src/main/resources/application-bdc.properties b/dictionaryweights/src/main/resources/application-bdc.properties
new file mode 100644
index 0000000..1c97a81
--- /dev/null
+++ b/dictionaryweights/src/main/resources/application-bdc.properties
@@ -0,0 +1,9 @@
+spring.application.name=dictionaryweights
+spring.main.web-application-type=none
+
+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}/picsure?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true¤tSchema=dict
+spring.datasource.username=${DATASOURCE_USERNAME}
+
+weights.filename=/weights.csv
\ No newline at end of file
diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/datasource/DataSourceVerifier.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/datasource/DataSourceVerifier.java
new file mode 100644
index 0000000..9e36308
--- /dev/null
+++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/datasource/DataSourceVerifier.java
@@ -0,0 +1,39 @@
+package edu.harvard.dbmi.avillach.dictionary.datasource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.stereotype.Service;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+@Service
+public class DataSourceVerifier {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DataSourceVerifier.class);
+
+ private final DataSource dataSource;
+
+ @Autowired
+ public DataSourceVerifier(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ @EventListener(ContextRefreshedEvent.class)
+ public void verifyDataSourceConnection() {
+ try (Connection connection = dataSource.getConnection()) {
+ if (connection != null) {
+ LOG.info("Datasource connection verified successfully.");
+ } else {
+ LOG.info("Failed to obtain a connection from the datasource.");
+ }
+ } catch (SQLException e) {
+ LOG.info("Error verifying datasource connection: {}", e.getMessage());
+ }
+ }
+
+}
diff --git a/src/main/resources/application-bdc.properties b/src/main/resources/application-bdc.properties
index 352e321..3660041 100644
--- a/src/main/resources/application-bdc.properties
+++ b/src/main/resources/application-bdc.properties
@@ -1,6 +1,6 @@
spring.application.name=dictionary
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driver-class-name=com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver
-spring.datasource.url=jdbc-secretsmanager:postgres://${DATASOURCE_URL}/auth?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true
+spring.datasource.url=jdbc-secretsmanager:postgresql://${DATASOURCE_URL}/picsure?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true¤tSchema=dict
spring.datasource.username=${DATASOURCE_USERNAME}
-server.port=80
\ No newline at end of file
+server.port=80