Hi Robert, I have an external keystore from which I want to replace the values for the config variables. If fetching from external keystore is disabled, than the config values should be picked up from environment variables.
Hence for doing this I need to first check, if the fetching from external keystore is disabled or not and then properly set by configuration. Hope this makes it more clear. On Tuesday, April 2, 2019 at 11:43:05 AM UTC-4, Robert Di Falco wrote: > > Can you provide more details at a higher level of what you are trying to > achieve? > > On Tue, Apr 2, 2019 at 6:52 AM Vaibhav Somani <[email protected] > <javascript:>> wrote: > >> I am working on dropwizard project where I want to set the a different >> configuration source provider based on the if a config value is enabled or >> not. >> >> Since the configuration object isn't accessible in initialize, I created >> a global bootstrap variable. Though I am still unable to update the config >> values. >> >> Any help or guidance on how can this be resolved? >> >> private Bootstrap<MyConfiguration> bootstrap; >> @Overridepublic void initialize(final Bootstrap<MyConfiguration> bootstrap) { >> super.initialize(bootstrap); >> this.bootstrap = bootstrap;} >> >> @Overridepublic void run(final MyConfiguration configuration, >> final Environment environment) { >> >> this.bootstrap.setConfigurationFactoryFactory( >> new ImportConfigurationFactoryFactory<>()); >> >> if(configuration.isEnabled()) { >> this.bootstrap.setConfigurationSourceProvider( >> new SubstitutingSourceProvider( >> this.bootstrap.getConfigurationSourceProvider(), >> new StrSubstitutor(new ConfigSwitcher()))); >> } else { >> this.bootstrap.setConfigurationSourceProvider( >> new SubstitutingSourceProvider( >> this.bootstrap.getConfigurationSourceProvider(), >> new EnvironmentVariableSubstitutor(false))); >> }} >> >> -- >> You received this message because you are subscribed to the Google Groups >> "dropwizard-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
