Search in sources :

Example 6 with EnvironmentVariableSubstitutor

use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project lithium by wireapp.

the class Server method initialize.

@Override
public void initialize(Bootstrap<Config> bootstrap) {
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
    bootstrap.addBundle(new SwaggerBundle<>() {

        @Override
        protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(Config configuration) {
            return configuration.swagger;
        }
    });
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor) SwaggerBundleConfiguration(io.federecio.dropwizard.swagger.SwaggerBundleConfiguration)

Example 7 with EnvironmentVariableSubstitutor

use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project OpenLineage by OpenLineage.

the class ProxyApp method initialize.

/**
 * Initialize the application.
 *
 * @param bootstrap combination of the yml file and environment variables
 */
@Override
public void initialize(@NonNull Bootstrap<ProxyConfig> bootstrap) {
    // Enable variable substitution with environment variables.
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(ERROR_ON_UNDEFINED)));
    bootstrap.getObjectMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor)

Example 8 with EnvironmentVariableSubstitutor

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)));
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) MultiPartBundle(io.dropwizard.forms.MultiPartBundle) ActiveMQBundle(com.kjetland.dropwizard.activemq.ActiveMQBundle) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor) AssetsBundle(io.dropwizard.assets.AssetsBundle)

Example 9 with EnvironmentVariableSubstitutor

use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project polaris by ractf.

the class NodeMain method initialize.

@Override
public void initialize(final Bootstrap<NodeConfiguration> bootstrap) {
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
    bootstrap.addBundle(new ConsulBundle<>(getName()) {

        @Override
        public ConsulFactory getConsulFactory(final NodeConfiguration configuration) {
            return configuration.getConsulFactory();
        }
    });
    bootstrap.addBundle(GuiceBundle.builder().modules(new NodeModule()).enableAutoConfig("uk.co.ractf.polaris.consul", "uk.co.ractf.polaris.node.metrics", "uk.co.ractf.polaris.node.runner", "uk.co.ractf.polaris.node.resources", "uk.co.ractf.polaris.node.service").build());
    bootstrap.addBundle(new PrometheusBundle());
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor) PrometheusBundle(org.dhatim.dropwizard.prometheus.PrometheusBundle) ConsulFactory(com.smoketurner.dropwizard.consul.ConsulFactory)

Example 10 with EnvironmentVariableSubstitutor

use of io.dropwizard.configuration.EnvironmentVariableSubstitutor in project pay-publicapi by alphagov.

the class PublicApi method initialize.

@Override
public void initialize(Bootstrap<PublicApiConfig> bootstrap) {
    bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false)));
    bootstrap.getObjectMapper().getSubtypeResolver().registerSubtypes(LogstashConsoleAppenderFactory.class);
    bootstrap.getObjectMapper().getSubtypeResolver().registerSubtypes(GovUkPayDropwizardRequestJsonLogLayoutFactory.class);
}
Also used : SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor)

Aggregations

EnvironmentVariableSubstitutor (io.dropwizard.configuration.EnvironmentVariableSubstitutor)27 SubstitutingSourceProvider (io.dropwizard.configuration.SubstitutingSourceProvider)27 DataSourceFactory (io.dropwizard.db.DataSourceFactory)6 LoggingBundle (uk.gov.ida.bundles.LoggingBundle)6 MonitoringBundle (uk.gov.ida.bundles.MonitoringBundle)6 ServiceStatusBundle (uk.gov.ida.bundles.ServiceStatusBundle)6 GuiceBundle (uk.gov.ida.hub.shared.guice.GuiceBundle)6 PrometheusBundle (uk.gov.ida.metrics.bundle.PrometheusBundle)5 SwaggerBundleConfiguration (io.federecio.dropwizard.swagger.SwaggerBundleConfiguration)3 EventEmitterModule (uk.gov.ida.eventemitter.EventEmitterModule)3 ConsulFactory (com.smoketurner.dropwizard.consul.ConsulFactory)2 AssetsBundle (io.dropwizard.assets.AssetsBundle)2 ConfigurationSourceProvider (io.dropwizard.configuration.ConfigurationSourceProvider)2 ResourceConfigurationSourceProvider (io.dropwizard.configuration.ResourceConfigurationSourceProvider)2 JdbiExceptionsBundle (io.dropwizard.jdbi3.bundles.JdbiExceptionsBundle)2 PrometheusBundle (org.dhatim.dropwizard.prometheus.PrometheusBundle)2 RenderCommand (com.example.helloworld.cli.RenderCommand)1 ActiveMQBundle (com.kjetland.dropwizard.activemq.ActiveMQBundle)1 ElasticsearchConfiguration (gov.ca.cwds.rest.ElasticsearchConfiguration)1 ApiException (gov.ca.cwds.rest.api.ApiException)1