【发布时间】:2019-12-09 09:46:20
【问题描述】:
我在 NodeJS 后端使用 dotenv。在我添加新的环境变量之前一切正常 现在,当应用程序在 docker 中启动时出现错误
Cannot start the application. Error: MISSING CONFIG VALUES: LDAP_DN
at Object.config (/home/node/app/node_modules/dotenv-extended/lib/index.js:71:19)
at new PrivbackApplication (/home/node/app/src/application.ts:70:15)
at Object.main (/home/node/app/src/index.ts:7:15)
at Object.<anonymous> (/home/node/app/index.js:17:15)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11
我的配置:
根应用程序文件夹中的 .env.example 配置文件(我添加了 LDAP_DN)
NODE_ENV=
LDAP_DN=
LDAP_PROTOCOL=
LDAP_HOST=
LDAP_PORT=
在 application.ts 中
dotenv.config();
dotenvExt.load({
schema: '.env.example',
errorOnMissing: true,
});
dotenvExt.load 行错误点
有什么想法吗?
谢谢
劳伦特
【问题讨论】: