kerimdzhanov / dotenv-flow

Loads environment variables from .env.[development|test|production][.local] files for Node.js® projects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why items in .env.local is not picked ?

qiulang opened this issue · comments

A simple test case

# .env
WS_PORT=8090

# .env.development
WS_PORT=8092

# .env.local
WS_PORT=8091

# ./test/test.js
require('dotenv-flow').config()
console.log('ws port:', process.env.WS_PORT)

# package.json

"test": "NODE_ENV=development node test/test.js",
"test2": "node test/test.js",

npm run test or npm run test2 both ouput 8090, with message dotenv-flow: "WS_PORT" is already defined in process.env and will not be overwritten, but why ?

Hi I create a project to reproduce my issue https://github.com/qiulang/dotflowTest

Sorry I finally figure why. I installed a zsh plugin called dotenv, so whenever cd into a folder that contains .env files it will load it item in env variables
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dotenv