![]() |
VOOZH | about |
dotnet add package CatConsult.AppConfigConfigurationProvider --version 3.2.0
NuGet\Install-Package CatConsult.AppConfigConfigurationProvider -Version 3.2.0
<PackageReference Include="CatConsult.AppConfigConfigurationProvider" Version="3.2.0" />
<PackageVersion Include="CatConsult.AppConfigConfigurationProvider" Version="3.2.0" />Directory.Packages.props
<PackageReference Include="CatConsult.AppConfigConfigurationProvider" />Project file
paket add CatConsult.AppConfigConfigurationProvider --version 3.2.0
#r "nuget: CatConsult.AppConfigConfigurationProvider, 3.2.0"
#:package CatConsult.AppConfigConfigurationProvider@3.2.0
#addin nuget:?package=CatConsult.AppConfigConfigurationProvider&version=3.2.0Install as a Cake Addin
#tool nuget:?package=CatConsult.AppConfigConfigurationProvider&version=3.2.0Install as a Cake Tool
An opinionated .NET Configuration Provider for AWS AppConfig.
This configuration provider supports the following freeform configuration profile type formats:
This provider also supports the Feature Flag configuration profile type and renders .NET FeatureManagement-compatible configuration. Please refer to the Feature Flag section below for more information.
First, download the provider from NuGet:
dotnet add package CatConsult.AppConfigConfigurationProvider
Then add the provider using the AddAppConfig extension method:
builder.Configuration.AddAppConfig();
By default, the provider will look for a configuration section named AppConfig.
This can be overriden by specifying a different section name:
builder.Configuration.AddAppConfig("MyCustomName");
The provider requires some minimal configuration in order for it to know which AppConfig profiles to load:
{
"AppConfig": {
"Profiles": [
"abc1234:def5678:ghi9123",
"q2w3e25:po92j45:bt9s090:300"
]
}
}
As you can see in the example above, the AppConfig metadata are encoded as a formatted string:
ApplicationId:EnvironmentId:ProfileId[:ReloadAfter]
ReloadAfter is an optional 4th parameter that configures the reload/refresh period.
It is an integer that represents time in seconds.
If not specified, it defaults to the provider's default setting, which is 90 seconds.
The default ReloadAfter setting can be overridden as well:
{
"AppConfig": {
"Defaults": {
"ReloadAfter": 120
}
}
}
Feature Flag configuration profile types can be consumed by the provider and are automatically translated to .NET FeatureManagement-compatible configuration. Both simple and complex feature flags are supported.
To specify feature flag profiles, add the profile metadata to the FeatureFlags array instead of Profiles:
{
"AppConfig": {
"Profiles": [
// Freeform configuration profile
"abc1234:def5678:ghi9123",
// Freeform configuration profile
"q2w3e25:po92j45:bt9s090:300"
],
"FeatureFlags": [
// Feature Flag profile
"bvt1234:glw6348:zup8532"
]
}
}
Due to the differences between the AppConfig and FeatureManagement configuration setup and the validation constraints that AppConfig uses for feature flags, the provider has some opinionated quirks when it comes to feature flags.
Simple Flags
A "simple" flag is one that can be enabled or disabled and does not contain any attributes. AppConfig returns these as an object with a single field:
{
"customFeatureFlag": {
"enabled": true
}
}
This gets translated to:
{
"FeatureManagement": {
"CustomFeatureFlag": true
}
}
The provider will automatically convert the name of the flag to PascalCase.
Complex Flags
A "complex" flag is one that contains attributes that specify feature filters and, optionally, their parameters.
AppConfig will return these like this:
{
"complexFlag": {
"enabled": true,
"customProperty": "customValue",
// etc.
}
}
To get around some of the limitations of how AppConfig lets you construct attributes, the following transformations rules are in place:
enabled field is always ignoredrequirementType field is converted to RequirementType
All or Any (default if omitted)featureFilter and have a blank/null value (e.g. "alwaysOn": null)featureFilter__parameterName and have a value for the parameter (e.g. "percentage__value": 50)
__) to separate the filter name from the parameter name"percentage__value": 50, "percentage__foobar": "baz")_) (e.g. "namespace_featureFilter": null → Namespace.FeatureFilter)Microsoft.Targeting and its parameters)There are likely to be some limitations with this approach, so please open an issue if you find any that don't match your use case.
A sample ASP.NET Web Application is available in the samples/AppConfigTesting folder.
In your own AWS environment, copy the contents of yamltest.yml into a new AppConfig freeform configuration profile.
Then, create a new Feature Flag configuration profile with 2 flags: enableFoobar and complexFlag.
Feel free to add any attributes you want to complexFlag that match the rules described in the Feature Flags section.
Then, use dotnet user-secrets to specify the AppConfig profile:
# Freeform configuration profile
dotnet user-secrets set "AppConfig:Profiles:0" "abc1234:def5678:ghi9123" # <-- Replace with your own profile
# Feature Flag configuration profile
dotnet user-secrets set "AppConfig:FeatureFlags:0" "bvt1234:glw6348:zup8532" # <-- Replace with your own profile
Finally, ensure that you have the correct AWS credentials/profile configured in your environment, and run the sample:
dotnet run
Experiment by changing the configuration on AppConfig and deploying. After a while, you should see the application reload the configuration automatically when you refresh the home page.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 3.2.0 | 580 | 5/5/2026 | |
| 3.1.0 | 527 | 3/12/2026 | |
| 3.0.0 | 260 | 2/26/2026 | |
| 2.5.1 | 23,830 | 1/10/2024 | |
| 2.5.0 | 259 | 1/9/2024 | |
| 2.0.0 | 287 | 1/2/2024 | |
| 2.0.0-beta | 242 | 12/8/2023 | |
| 2.0.0-alpha | 249 | 12/7/2023 | 2.0.0-alpha is deprecated because it has critical bugs. |
| 1.1.0 | 4,091 | 7/7/2023 | |
| 1.0.0 | 4,291 | 6/25/2023 |