gpt4 book ai didi

Node.js - 如何通过配置获取自定义环境变量?

转载 作者:太空宇宙 更新时间:2023-11-03 23:16:16 27 4
gpt4 key购买 nike

我正在运行 config@1.29.4 并尝试使用 .\config\custom-environment-variables.json 从环境变量中获取设置,但不起作用。但是,它从 .\config\default.json 读取就很好。

.\config\custom-environment-variables.json

{
"jwtPrivateKey": "sс_jwtPrivateKey"
}

.\config\default.json

{
"jwtPrivateKey": "default"
}

console.log(config.get('jwtPrivateKey'))总是打印默认

我在cmd中做了这个:SET sс_jwtPrivateKey=12345678

我尝试了新版本的配置,同样的情况。

当我将 config/default 中的 key 属性设置为空字符串时,它不会打印任何内容。我该如何解决这个问题?

如何获取sc_jwtPrivateKey的值?

谢谢!

最佳答案

我按照如下方式解决了这个问题:我使用了 SETX sс_jwtPrivateKey 12345678,而不是 SET sс_jwtPrivateKey=12345678

关于Node.js - 如何通过配置获取自定义环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55115690/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com