aws / aws-dotnet-extensions-configuration

This repository hosts various libraries that help developers configure .NET applications using AWS services.
https://aws.amazon.com/developer/language/net/
Apache License 2.0
179 stars 57 forks source link

Document how to use TOptions/binding with hierarchy #182

Closed jchoca closed 1 month ago

jchoca commented 1 month ago

Describe the issue

I can't seem to find anywhere where it's documented that hierarchical keys should be delimited by a slash. For example, say I have something like the following:

public class ApplicationSettings
{
    public SqlSettings PrimaryDbRead { get; set; }
    public SqlSettings PrimaryDbWrite { get; set; }
}

public class SqlSettings
{
    public string Server { get; set; }
    public string DatabaseName { get; set; }
    public string User { get; set; }
    public string Password { get; set; }
}

then in my Program.cs file I have services.Configure<ApplicationSettings>(config);. If I were mapping that to an environment variable, I would use PrimaryDbRead__Password as a key. Not knowing any better, I might use an SSM param like /my-application/PrimaryDbRead__Password, but that doesn't work and instead needs to be /my-application/PrimaryDbRead/Password. It would probably be better if both just worked, but having this documented is better than nothing. Is this documented anywhere?

Links

https://github.com/aws/aws-dotnet-extensions-configuration/blob/master/README.md

bhoradc commented 1 month ago

Hello @jchoca,

Thank you for submitting the documentation change request. Our team will review the behaviour you've described and work on documenting the expected approach for structuring configuration keys.

We appreciate you highlighting this, and we'll make the necessary changes accordingly.

Regards, Chaitanya

ashishdhingra commented 1 month ago

Readme updated with added sections for Hierarchical configuration data.

github-actions[bot] commented 1 month ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

jchoca commented 1 month ago

Thank you!