azure application settings - how to add nested item

后端 未结 2 1124
忘掉有多难
忘掉有多难 2021-01-18 03:35

i have a appservice on azure that is running a .net core api.

in my appsettings.json file i have a section something similar to :

\"Serilog\": {    
         


        
相关标签:
2条回答
  • 2021-01-18 03:58

    you use : to nest:keys:down

    cross platform you use __ to nest__keys__down (since : are bad for envars in *nix)

    the key thing is it's not azure doing anything special... azure just sets env vars for the app from there. it's .net core config that's actually looking at the env vars and doing special things see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/index?tabs=basicconfiguration&view=aspnetcore-3.1#hierarchical-configuration-data & https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/index?tabs=basicconfiguration&view=aspnetcore-3.1#environment-variables-configuration-provider

    0 讨论(0)
  • 2021-01-18 04:19

    As per this article, you would have to use syntax something like "CustomSettings__MySpecificSetting".

    Hope this helps!! Cheers!! :)

    0 讨论(0)
提交回复
热议问题