The supports environment variable substitution inside Dropwizard configuration files. EnvironmentConfigBundle
The supports environment variable substitution inside Dropwizard configuration files. EnvironmentConfigBundle
In the example applications, environment variable substitution is used for . We can see this in action by running the command, with and without the environment variable set. defaultName template: Hello, %s! defaultName: ${DW_DEFAULT_NAME:-Stranger} render $ java -jar target/liftwizard-example-0.1.0.jar render example.yml --include-default INFO [2020-05-02 03:07:41,910] com.example.helloworld.cli.RenderCommand: DEFAULT => Hello, Stranger! $ DW_DEFAULT_NAME=EnvSubstitution java -jar target/liftwizard-example-0.1.0.jar render example.yml --include-default INFO [2020-05-02 03:08:05,685] com.example.helloworld.cli.RenderCommand: DEFAULT => Hello, EnvSubstitution!
@Override public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) { // Enable variable substitution with environment variables bootstrap.setConfigurationSourceProvider( new SubstitutingSourceProvider( bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false) ) ); // ... }
lives in the module. @Override public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) { bootstrap.addBundle(new EnvironmentConfigBundle()); // ... } EnvironmentConfigBundle liftwizard-bundle-environment-config <dependency> <groupId>io.liftwizard</groupId> <artifactId>liftwizard-bundle-environment-config</artifactId> </dependency>