Skip to content

Document how to use TOptions/binding with hierarchy #182

@jchoca

Description

@jchoca

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions