Comments (2)
Thanks for trying this out @kamalsivalingam.
By default, the config provider of the App Configuration will load keys with no labels for simplicity. When labels are used, they can be loaded with the Use
function. The example below loads all keys with the label mylabel
.
configBuilder.AddAzureAppConfiguration(options =>
{
options.Connect(configuration["connection_string"])
.Use(KeyFilter.Any, "mylabel")
});
Labels provide an extra dimension to key-values, so each key can have multiple values at the same time. It can be used to differentiate config for different environments (dev, test, ...), different microservices (app1, app2, ...), different regions and so on so forth. We also expect it will be a very typical use of labels for versioning. For example, I have config labeled with v1
and v2
. In my app, I want the v2
config overwrites the v1
config when they have the same key. Then I will have something like this
configBuilder.AddAzureAppConfiguration(options =>
{
options.Connect(configuration["connection_string"])
.Use(KeyFilter.Any, "v1")
.Use(KeyFilter.Any, "v2")
});
Please check out the AzureAppConfigurationOptions
class, which provides APIs for filtering key-values, watching for changes, connecting with managed identity and so on.
Hope this helps. Please let me know if you have any other questions.
from appconfiguration.
I've added 2 keys with same name (poc-api:myvalue), one with label "Development", the other with no label.
With this code :
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args).ConfigureAppConfiguration((hostingContext, config) =>
{
var settings = config.Build();
config.AddAzureAppConfiguration(options =>
{
options.Connect(settings["ConnectionStrings:AppConfiguration"])
.Use(KeyFilter.Any, LabelFilter.Null)
.Use(KeyFilter.Any, "Development")
.UseFeatureFlags(optionsff =>
{
optionsff.PollInterval = new TimeSpan(0, 0, 5);
});
options.Watch("poc-api:myvalue",new TimeSpan(0,0,5));
}); ;
})
.UseStartup<Startup>();
It seems I cannot get the value for the key with label "Development", i always get the one without the label
using
<PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="1.0.0-preview-008920001-990" />
Code "Inspired" by
https://docs.microsoft.com/en-us/azure/azure-app-configuration/howto-best-practices
from appconfiguration.
Related Issues (20)
- .NET Client - Required signing request header 'date' not found HOT 1
- Create YAML Documentation for AzureAppConfiguration HOT 1
- Missing .Net Core 6.x Example with new Program.Cs Template HOT 2
- How to check Helm Values HOT 4
- Feature request: add optional description field HOT 2
- Support multiple provider instances per namespace HOT 5
- AppConfiguration references are not resolved in local.settings.json HOT 2
- Define separator as optional in AzureAppConfigurationPush@6 task HOT 2
- Support LoadBalance mode in providers HOT 2
- Dynamically adjust cache duration? HOT 7
- File-style Secret support in Kubernetes Provider
- Trying to use AppConfigurationClient to get "getConfigurationSetting" in my React App but getting CORS on localhost:3000 HOT 11
- Refresh Not working with Azure App Configuration Spring Boot 2.6.6 HOT 1
- Helm Chart Example - AzureAppConfigurationProvider Resource HOT 15
- The pattern of "configuration_reference" is .NET-only HOT 2
- AzureAppConfigurationPush@6 in combination with Workload Identity Federation does not seem to work HOT 3
- Workload Identity Federation (Auotmatic) issue! HOT 2
- Are there plans to support loading external configuration via Spring's `spring.config.import` mechanism? HOT 1
- Kubernetes provider fails to run on arm platform HOT 9
- Request for documentation or source code for AzureAppConfigurationPush@6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appconfiguration.