简体   繁体   English

覆盖来自 Azure 应用程序设置的 appsettings.json 值

[英]Overriding appsettings.json values from Azure App settings

I have a set of appsetting vaues as below.我有一组 appsetting 值如下。 We are on Windows App service我们在 Windows 应用服务

"MainDomains": {
"Domains": [
  {
    "Id": "123456",        
    "Domain": "Technical",       
    "PolicyUrl": "https://www.mytechdomain.net",
    "LearningPoint": "https://www.mytechdomain.net",
    "Hostnames": [
      "https://localhost:4567",
      "http://localhost:34565",          
      "https://mytechdomain.latestlearn.com"
    ],
    "UsePreviewContent": true,
    "IsDefault": true,
    "OriginEmail": "info@techdomain.net",
    "mytechname": "Techdomain"
  }
]

} }

How would i properly set these values in Azure App settings under configurations.我将如何在配置下的 Azure 应用程序设置中正确设置这些值。 I have already tried like property1:property2:0 --> xxxvalue.我已经尝试过像 property1:property2:0 --> xxxvalue。 This does not seem to work however.然而,这似乎不起作用。 What I am guessing is may be I have an array within another array.我猜可能是我在另一个数组中有一个数组。 Where first array is the MainDomains and another array within the MainDomains array is the Domains.其中第一个数组是 MainDomains,而 MainDomains 数组中的另一个数组是 Domains。

You should set the app setting name with the same delimited format in the appsettings.json .您应该在appsettings.json中使用相同的分隔格式设置应用程序设置名称。 But just like Gaurav Mantri said, use double underscore __ rather than : on portal.但就像Gaurav Mantri所说,在门户网站上使用双下划线__而不是:

Refer to the description about Configuration keys and values :请参阅有关配置键和值的说明:

In environment variables, a colon separator may not work on all platforms.在环境变量中,冒号分隔符可能不适用于所有平台。 A double underscore, __ , is supported by all platforms and is automatically converted into a colon : .所有平台都支持双下划线__ ,并自动转换为冒号:

You could also have a look at the official document about how to set App Settings .您还可以查看有关如何设置 App Settings 的官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM