Skip to content

Add new API to reload on changes to key-values #536

@amerjusupovic

Description

@amerjusupovic

Currently, the provider only has the AzureAppConfigurationRefreshOptions.Register method as a way to monitor individual key-values for refresh. By adding a new API, we can enable monitoring for all of the key-values to be loaded by the provider. Then, when a refresh is triggered, the provider will reload the configuration if any of the selected key-values have changed in App Configuration. You can only call one of RegisterAll or Register, not both.

Proposed API: RegisterAll

config.AddAzureAppConfiguration(options => {
     options.ConfigureRefresh(refresh =>
     {
         refresh.RegisterAll();
     });
});

In the example above, since the provider selects all key-values with label null by default if no Select or SelectSnapshot statement is present, all of the key-values that have no label will be monitored when RegisterAll is called. If any of them have changed since the last refresh attempt, the configuration will be reloaded.

config.AddAzureAppConfiguration(options => {
     options.Select("TestApp*", "prod");
     options.ConfigureRefresh(refresh =>
     {
         refresh.RegisterAll();
     });
});

Now, changes to key-values that start with TestApp and have the label prod will trigger a configuration reload.

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions