Skip to content

An extension to enable variable expansion in .NET config files

License

Notifications You must be signed in to change notification settings

pereirazc/Configuration.Expander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configuration.Expander Extension

Nuget

An extension to enable configuration variable expansion. It depends on Microsoft.Extensions.Configuration and Microsoft.Extensions.Configuration.Binder.

Usage

In any declaration you can use a variable expansion like ${ <VARIABLE_NAME> }. The <VARIABLE_NAME> will be expandaded (replaced) by any value which key is defined in the Configuration object. A fallback value can be provided for the abscense of a variable/configuration ${ <VARIABLE_NAME> ?? <DEFAULT_VALUE> }

Declaration

{
    "db": {
        "host": "${ DB_HOST ?? localhost }"
    }
}

Usage in code

configuration.ResolveValue<String>("db:host")

About

An extension to enable variable expansion in .NET config files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published