【发布时间】:2021-01-18 23:46:35
【问题描述】:
当我运行我的index.js 文件时,我得到了Configuration property "mail.host" is not defined。我不明白为什么。
config.get('name') 工作正常。我设置了我的NODE_ENV=production。有人可以帮忙吗?
index.js
const config = require('config');
console.log(config.get('name'));
console.log(config.get('mail.host'));
production.json
{
"name": "My app - production",
"mail": {
"host": "production-server"
}
}
【问题讨论】:
-
production.json应该在一个名为config的文件夹中