Skip to content

Commit

Permalink
Enable environment variables in config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorengarenar committed Jan 3, 2023
1 parent e44ea5b commit b2b608e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b2b608e

Please sign in to comment.