In development uses one source of truth:
.env
.env.{NODE_ENV}
and .env.{NODE_ENV}.local
files in root of repository
Inspired by https://nextjs.org/docs/basic-features/environment-variables#environment-variable-load-order
Environment variables are looked up in the following places, in order, stopping once the variable is found.
- process.env
- .env.$(NODE_ENV).local
- .env.local
- .env.$(NODE_ENV)
- .env
For example, if NODE_ENV is development and you define a variable in both .env.development.local and .env, the value in .env.development.local will be used.
Note: The allowed values for NODE_ENV are production, development and test.
Also read more: https://github.com/kerimdzhanov/dotenv-flow#variables-overwritingpriority