如何在Azure函数的AppSettings.json中添加配置值.是否有任何结构? [英] How to add configuration values in AppSettings.json in Azure functions. Is there any structure for it?

查看:107
本文介绍了如何在Azure函数的AppSettings.json中添加配置值.是否有任何结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

appsettings.json添加密钥的标准结构是什么? 另外,如何在我们的run.csx中读取这些值? 通常在app.config中,我们有ConfigurationManager.GetSettings["SettingName"]; Azure Function中有任何类似的实现吗?

What is the standard structure to add keys to appsettings.json? Also, how to read those values in our run.csx? Normally in app.config, we had ConfigurationManager.GetSettings["SettingName"]; Is there any similar implementation in Azure Function?

推荐答案

如所述

这些设置也可以在您的代码中作为环境变量读取.在C#中,使用System.Environment.GetEnvironmentVariableConfigurationManager.AppSettings.在JavaScript中,使用process.env.指定为系统环境变量的设置优先于local.settings.json文件中的值.

These settings can also be read in your code as environment variables. In C#, use System.Environment.GetEnvironmentVariable or ConfigurationManager.AppSettings. In JavaScript, use process.env. Settings specified as a system environment variable take precedence over values in the local.settings.json file.

这篇关于如何在Azure函数的AppSettings.json中添加配置值.是否有任何结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆