azure - 天蓝色应用程序设置 - 如何添加嵌套项
问题描述
我在 azure 上有一个运行 .net core api 的 appservice。
在我的 appsettings.json 文件中,我有一个类似于以下内容的部分:
"Serilog": {
"LevelSwitches": { "$controlSwitch": "Information" },
"MinimumLevel": {
"ControlledBy": "$controlSwitch",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "LOGS\\log.json",
"rollingInterval": "Day",
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
}
},
{
"Name": "Seq",
"Args": {
"serverUrl": "https://MyLoggingServer",
"apiKey": "AAAAAAAAAAAAAAAAA",
"controlLevelSwitch": "$controlSwitch"
}
}
]}
在 azure 门户的 azure appsetting 部分中,我不确定如何设置 apiKey,在其他更简单的设置中,我在 appsettings.json 中有另一个部分
"CustomSettings": {
"MySpecificSetting": "ABCDEFG",
}
然后在 azure 门户中,我可以通过执行以下操作来设置设置
CustomSettings:MySpecificSetting
但我不确定这种语法如何允许我访问 writeTo 数组中的特定项目
谢谢你的帮助
解决方案
你使用 : 嵌套:keys:down
您使用 __ 来嵌套 __keys__down 的跨平台(因为 : 对 *nix 中的 envar 不利)
关键是它不是天蓝色做任何特别的事情......天蓝色只是从那里为应用程序设置环境变量。它是 .net 核心配置,它实际上是在查看环境变量并做一些特殊的事情,请参阅https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/index?tabs=basicconfiguration&view=aspnetcore-3.1#hierarchical -配置数据和https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/index?tabs=basicconfiguration&view=aspnetcore-3.1#environment-variables-configuration-provider
推荐阅读
- mysql - 如何在 Angular 6 中显示 Spring Boot Data JPA Query 的响应
- sql - 如何优化和提高以下代码的性能?它获取大量记录,因此性能缓慢
- python - 在Django框架下上传未知数量(动态决定)的文件
- ruby-on-rails - 从 Rails 5 开始,何时需要手动设置 :inverse_of?
- javascript - MKDIR PHP & Header(位置:)
- shell - 重命名文件的脚本
- matlab - 如何修复“使用 hac 时出错(第 485 行)-索引超出数组边界”
- tensorflow - 使用不是符号张量的输入调用图层。[凯拉斯]
- unity3d - Unity 2D 拖放问题 iDropHandler
- python - 用户警告:“无法解析页眉或页脚,因此将被忽略”加载 xlsm 文件