I have an ASP.NET Core app with appsettings.json config file. One of the settings in the file is represented by the array of objects, like this:
{
"Globalization": {
"Languages": [
{
"DisplayName": "Ru",
"Code": "ru"
},
{
"DisplayName": "En",
"Code": "en"
}
]
}
}
In our CI system we use environment variables to override the configuration settings from file. It turns out that I can only override existing items or add new items to the array, but I can’t reduce the number of items using index notation ("Globalization__Languages__0__DisplayName" etc.).
And it’s the same with appsettings.{Environment}.json, I still have two language options even if I have just one item in it.
Of course I can make the base config empty or invent some other workaround, but am I missing something? Is there any way to neatly override the settings reducing the number of items (preferably with the help of environment variables)?