-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0792003
commit c9ea587
Showing
1 changed file
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,62 @@ | ||
# AWS AppConfig Configuration Provider for .NET | ||
|
||
TODO | ||
An opinionated [.NET Configuration Provider](https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration-providers) | ||
for AWS AppConfig that wraps [Amazon.Extensions.Configuration.SystemsManager](https://www.nuget.org/packages/Amazon.Extensions.Configuration.SystemsManager/). | ||
|
||
## Usage | ||
|
||
First, download the provider from NuGet: | ||
|
||
```shell | ||
dotnet add package CatConsult.AppConfigConfigurationProvider | ||
``` | ||
|
||
Then add the provider using the `AddAppConfig` extension method: | ||
|
||
```csharp | ||
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: | ||
|
||
```csharp | ||
builder.Configuration.AddAppConfig("MyCustomName"); | ||
``` | ||
|
||
## Configuration | ||
|
||
The provider requires some minimal configuration in order for it to know which AppConfig profiles to load: | ||
|
||
```json | ||
{ | ||
"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 30 seconds. | ||
|
||
The default `ReloadAfter` setting can be overridden as well: | ||
|
||
```json | ||
{ | ||
"AppConfig": { | ||
"Defaults": { | ||
"ReloadAfter": 90 | ||
} | ||
} | ||
} | ||
``` |