Skip to content

pengweiqhca/Microsoft.Extensions.Configuration.Placeholder

Repository files navigation

Configuration Placeholder Resolver .NET Configuration Provider

dotnet add package PW.Extensions.Configuration.Placeholder

{
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "SomeArray": ["a", "d"],
  "EmptyKey": "",
  "ResolvedPlaceholderFromEnvVariables": "${PATH??NotFound}",
  "UnresolvedPlaceholder": "${SomKeyNotFound??NotFound}",
  "ResolvedPlaceholderFromJson": "${Logging:LogLevel:System??${Logging:LogLevel:Default??NotFound}}",
  "ResolvedEmpty": "${EmptyKey||abc}",
  "IndexPolaceholder": "${SomeArray[1]}abc"
}
using Microsoft.Extensions.Configuration;
...

var builder = new ConfigurationBuilder()
    .AddXXX()
    // Add Placeholder resolver
    .AddPlaceholderResolver();
Configuration = builder.Build();
...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages