【问题标题】:how to read local.settings.json configuration in index.js file如何读取 index.js 文件中的 local.settings.json 配置
【发布时间】:2022-02-15 22:04:10
【问题描述】:

我有 NodeJS azure 函数,并且在 local.settings.json 文件中有一些变量集,

"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USER": "sa",
"NEO4J_PASSWORD": "Password1",

我想读取index.js文件中的这些变量来替换下面的硬编码,如何读取呢?

const driver = neo4j.driver(
"bolt://localhost:7687",
 neo4j.auth.basic("sa", "Password1")
);

【问题讨论】:

    标签: node.js azure-functions


    【解决方案1】:

    index.js 中,您需要调用process.env 方法来访问从local.settings.json 定义的应用程序设置作为环境变量,您可以看到以下解决方法:

    参考:Access local.settings.json application settings from Azure Functions - JavaScript

    【讨论】:

    • 谢谢!感谢分享文档!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-17
    • 2011-09-24
    • 2017-09-22
    • 2011-10-29
    相关资源
    最近更新 更多