-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Describe the bug
The extension throws a DuplicateParameterException
when a "duplicate" parameter is detected because the keys are case-insensitive in code but case-sensitive in Parameter Store. This means that an application that uses this extension on startup as describe in the documentation can be prevented from starting simply by adding a key to Parameter Store--no code changes.
Expected Behavior
The extension should gracefully handle a duplicate key, probably by letting the last value win since .NET configuration works that way anyway.
Current Behavior
The extension throws an exception. Handling the exception isn't really an option since the rest of the configuration won't be available.
Reproduction Steps
- Add a value to Parameter Store, e.g.
/myApp/myKey
- Add the prefix to the configuration using the application extension method:
builder.Configuration.AddSystemsManager("/myApp");
- Optionally start the app to show that it works
- Add a new value to Parameter Store having the same key as step 1 but with different casing, e.g.
/myApp/mykey
- Restart the app and note that it throws a DuplicateParameterException on startup
Possible Solution
I don't consider the addition of a configuration parameter to be an action that could cause an application to fail to start. While the conflict in keys is something I would definitely want to know about, I don't want the application to not start at least in production. My suggested behavior is allowing the last value to win, though perhaps the exact behavior could be configurable itself.
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Extensions.Configuration.SystemsManager 6.2.0
Targeted .NET Platform
.NET Core 7.0
Operating System and version
N/A