简体   繁体   中英

(dotenv) with NodeJS : Missing config value LDAP_DN

I use dotenv in a NodeJS back-end. Everything worked before i add a new env variable Now i get the error when application starts in 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)

NODE_ENV=
LDAP_DN=
LDAP_PROTOCOL=
LDAP_HOST=
LDAP_PORT=

In application.ts

dotenv.config();
    dotenvExt.load({
      schema: '.env.example',
      errorOnMissing: true,
    });

Error points dotenvExt.load line

Any idea?

Thanks

Laurent

Problem fixed

I missed the .env file I'va added LDAP_DN= in .env file now it works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM