I have a setting “MyCustomKey” in the appsettings.json file in an ASP.NET Core project:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"MyConnStr": "Password=..."
},
"MyCustomKey": "MyCustomKey Value coming from appsettings.json"
}
I would like to override it in the docker-compose.yml or docker-compose.override.yml file, so that
- No code change is needed in the web app
- If the overriding setting in the YML file is present, the YML setting will be used.
- If the YML setting is not present, the setting in appsettings.json will be used.
How do I do it? I know how to do it on the connection string, but I don’t know how to do it on an arbitrary app setting.