본문 바로가기
C#

[C#] local.settings.json 사용

by Minius 2021. 4. 8.
반응형

ABC.cs

            var config = new ConfigurationBuilder()
                .SetBasePath(context.FunctionAppDirectory)
                .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                .AddEnvironmentVariables()
                .Build();
                
#if DEBUG
            var webHookUrl = config["TeamsUrlDebug"];
#else
            var webHookUrl = config["TeamsUrl"];
#endif

 

local.settings.json

{
	"TeamsUrl":"asdf",
    "TeamsUrlDebug":"asdfDebug"
}

 

 

www.tomfaltesek.com/azure-functions-local-settings-json-and-source-control/

 

Azure Functions local.settings.json Secrets and Source Control

Since you've landed on this article, you must have experienced some of the confusion tied to not committing the local.settings.json file to source control. It's not entirely obvious how developers are supposed to manage the local application settings for t

www.tomfaltesek.com

 

댓글