Hi,

The value if the config is enabled or not is also in configuration.

The configuration looks like this.

```
externalKeystore:
  enabled: true
  bucketName: default

emailConfig:
  key: {$DEFAULT_EMAIL_KEY}
```

If enabled is false then, replace $DEFAULT_EMAIL_KEY with environment 
variable.
If enabled is true then, replace $DEFAULT_EMAIL_KEY with the value from 
external key store.



On Tuesday, April 2, 2019 at 12:01:08 PM UTC-4, Radomir Djurdjevic wrote:
>
> Hi
>
> Can't you write a script that checks whether keystore is available or not 
> and fill out env variables afterwards?
>
> Regards 
>
> On Tue, Apr 2, 2019, 5:58 PM Vaibhav Somani <[email protected] 
> <javascript:>> wrote:
>
>> 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]> 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].
>>>> 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] <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.

Reply via email to