Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using double underscores in AAC keys the configuration fails to load hierarchical structure and Options pattern fails #616

Open
brgrz opened this issue Jan 27, 2025 · 2 comments
Labels
good first issue Good for newcomers

Comments

@brgrz
Copy link

brgrz commented Jan 27, 2025

When using double underscores in AAC keys the configuration fails to load hierarchical structure and Options pattern fails.

Double underscores are supported from environment variables and are correctly turned into keys with colons which are then available to the Options pattern.

This same feature fails when keys with double underscores are loaded from AAC as described in more detail here

@zhiyuanliang-ms
Copy link
Contributor

zhiyuanliang-ms commented Jan 29, 2025

Hi, @brgrz

Can you try this workaround?

var appConfig = new ConfigurationBuilder()
    .AddAzureAppConfiguration(options =>
    {
        options.Connect(Environment.GetEnvironmentVariable("ConnectionString"));
        options.Map((setting) =>
        {
            setting.Key = setting.Key.Replace("__", ":");
            return new ValueTask<ConfigurationSetting>(setting);
        });
    })
    .Build();

We have a Map api. #355

I have a key App__Test__Key in my app config store.

Image

Using Map api can meet your need.
Image

@zhiyuanliang-ms
Copy link
Contributor

Hi, @brgrz Does this workaround solution work for you?

@samsadsam samsadsam moved this from In Progress to 👀 In Review in AppConfiguration-DotnetProvider Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: 👀 In Review
Development

No branches or pull requests

2 participants