From b2b608e8c3e8974243d13ae493ea0959d7d8137c Mon Sep 17 00:00:00 2001 From: Jorengarenar Date: Tue, 3 Jan 2023 19:46:01 +0100 Subject: [PATCH] Enable environment variables in config.yml --- .../src/main/java/com/commafeed/CommaFeedApplication.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java b/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java index cfd7b0ce5..5bfb3f052 100644 --- a/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java +++ b/commafeed-server/src/main/java/com/commafeed/CommaFeedApplication.java @@ -54,6 +54,8 @@ import io.dropwizard.Application; import io.dropwizard.assets.AssetsBundle; +import io.dropwizard.configuration.EnvironmentVariableSubstitutor; +import io.dropwizard.configuration.SubstitutingSourceProvider; import io.dropwizard.db.DataSourceFactory; import io.dropwizard.forms.MultiPartBundle; import io.dropwizard.hibernate.HibernateBundle; @@ -117,6 +119,10 @@ public DataSourceFactory getDataSourceFactory(CommaFeedConfiguration configurati bootstrap.addBundle(new AssetsBundle("/assets/", "/", "index.html")); bootstrap.addBundle(new MultiPartBundle()); + + // Enable variable substitution with environment variables + bootstrap.setConfigurationSourceProvider( + new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false))); } @Override