[英](dotenv) with NodeJS : Missing config value LDAP_DN
I use dotenv in a NodeJS back-end.我在 NodeJS 后端使用 dotenv。 Everything worked before i add a new env variable Now i get the error when application starts in docker
在我添加新的环境变量之前一切正常现在我在 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
My config :我的配置:
a .env.example config file in root application folder (I added LDAP_DN)根应用程序文件夹中的 .env.example 配置文件(我添加了 LDAP_DN)
NODE_ENV=
LDAP_DN=
LDAP_PROTOCOL=
LDAP_HOST=
LDAP_PORT=
In application.ts在 application.ts
dotenv.config();
dotenvExt.load({
schema: '.env.example',
errorOnMissing: true,
});
Error points dotenvExt.load line错误点 dotenvExt.load 行
Any idea?任何的想法?
Thanks谢谢
Laurent洛朗
Problem fixed问题已解决
I missed the .env file I'va added LDAP_DN= in .env file now it works我错过了 .env 文件我在 .env 文件中添加了 LDAP_DN= 现在它可以工作了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.