use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project verify-hub by alphagov.
the class StubEventSinkApplication method initialize.
@Override
public final void initialize(Bootstrap<StubEventSinkConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
GuiceBundle<StubEventSinkConfiguration> guiceBundle = defaultBuilder(StubEventSinkConfiguration.class).modules(new StubEventSinkModule()).build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
}
use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project verify-hub by alphagov.
the class PolicyApplication method initialize.
@Override
public final void initialize(Bootstrap<PolicyConfiguration> bootstrap) {
// Enable variable substitution with environment variables
bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
bootstrap.addBundle(new ServiceStatusBundle());
bootstrap.addBundle(new MonitoringBundle());
bootstrap.addBundle(new LoggingBundle());
bootstrap.addBundle(new IdaJsonProcessingExceptionMapperBundle());
final InfinispanBundle infinispanBundle = new InfinispanBundle();
// the infinispan cache manager needs to be lazy loaded because it is not initialized at this point.
bootstrap.addBundle(infinispanBundle);
guiceBundle = GuiceBundle.defaultBuilder(PolicyConfiguration.class).modules(getPolicyModule(), new EventEmitterModule(), bindInfinispan(infinispanBundle.getInfinispanCacheManagerProvider())).build();
bootstrap.addBundle(guiceBundle);
}
use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project timbuctoo by HuygensING.
the class TimbuctooV4 method initialize.
@Override
public void initialize(Bootstrap<TimbuctooConfiguration> bootstrap) {
// bundles
activeMqBundle = new ActiveMQBundle();
bootstrap.addBundle(activeMqBundle);
bootstrap.addBundle(new MultiPartBundle());
bootstrap.addBundle(new AssetsBundle("/static", "/static", "index.html"));
/*
* Make it possible to use environment variables in the config.
* see: http://www.dropwizard.io/0.9.1/docs/manual/core.html#environment-variables
*/
bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(true)));
}
use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project api-core by ca-cwds.
the class ElasticSearchLiveTestRunner method main.
/**
* Let 'er rip!
*
* @param args command line
* @throws Exception Exception rises to the top
*/
public static void main(String... args) throws Exception {
if (args.length < 2) {
throw new ApiException("Usage: java " + ElasticSearchLiveTestRunner.class.getName() + " <ES config file> <search terms>");
}
final String path = args[0];
final String searchFor = args[1];
final ConfigurationSourceProvider provider = new SubstitutingSourceProvider(new FileConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false));
ElasticsearchConfiguration config;
try (InputStream iss = provider.open(path)) {
config = YAML_MAPPER.readValue(iss, ElasticsearchConfiguration.class);
}
try (AutoCloseElasticsearchDao autoCloseDao = new AutoCloseElasticsearchDao(elasticsearchClient(config))) {
ElasticSearchLiveTestRunner job = new ElasticSearchLiveTestRunner(autoCloseDao, searchFor);
job.run();
}
}
use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project api-core by ca-cwds.
the class BaseApiApplication method initialize.
@Override
public final void initialize(Bootstrap<T> bootstrap) {
bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
bootstrap.addBundle(new ViewBundle<T>());
guiceBundle = GuiceBundle.<T>newBuilder().addModule(applicationModule(bootstrap)).setConfigClass(bootstrap.getApplication().getConfigurationClass()).enableAutoConfig(getClass().getPackage().getName()).build();
bootstrap.addBundle(guiceBundle);
bootstrap.addBundle(shiroBundle);
initializeInternal(bootstrap);
}
Aggregations