This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
[New Feature Request] appsettings.json should have syntax support to enable usage of placeholders for Environment Variables (or any other setting from same config) #1248
I realized this while working on a code where I had to add transformations on very complex JSON object.
The transformation required were very simple.
For ex. I just wanted environment name to be present in a setting.
The issue was that setting was not at top level... there was an array at top level and inside one of the object, there was another array and I wanted to replace the placeholder for only one entry in this nested array.
In appsettings.json transformation files, there is no support yet to have a placeholder. The value of placehoder can come either from same appsettings.json file or it can come from some environment variable.
For ex. if my appsettings.json is as shown below:
{
"AppSettings": {
"ApplicationName": "MyWebApp"
},
"SomeDependentSetting": "Current environment is {env::ASPNETCORE_ENVIRONMENT}",
"AnotherSetting": "Current Application is {config::AppSettings:ApplicationName}"
}
This feature would really make configuration transformations easy.
I realized this while working on a code where I had to add transformations on very complex JSON object. The transformation required were very simple.
For ex. I just wanted environment name to be present in a setting.
The issue was that setting was not at top level... there was an array at top level and inside one of the object, there was another array and I wanted to replace the placeholder for only one entry in this nested array.
In appsettings.json transformation files, there is no support yet to have a placeholder. The value of placehoder can come either from same appsettings.json file or it can come from some environment variable.
For ex. if my appsettings.json is as shown below:
This feature would really make configuration transformations easy.