How to override an ASP.NET Core configuration array setting using environment variables
· One min read
假如一个 appsettings.json 文件, 需要在环境变量中添加配置覆盖 AppSettings/EnabledWorkspace 节:
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"System": "Information",
"Microsoft": "Information"
}
},
//Basic Auth for Tapd api
"AppSettings": {
"EnabledWorkspace": [ "58645295", "44506107", "84506239" ]
}
}
这样配置:
AppSettings__EnabledWorkspace__0 = 58645295 AppSettings__EnabledWorkspace__1 = 44506107 AppSettings__EnabledWorkspace__2 = 84506239
Refer to:
How to override an ASP.NET Core configuration array setting using environment variables
