Question: Possible to load multiple .env files into the shell?
See original GitHub issueQuestion: Is it possible to load multiple .env files into the shell?
npx dotenv-extended --path=first.env dotenv-extended --path=second.env node herro.js
Or something like:
npx dotenv-extended --path=first.env,second.env node herro.js
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Cleaner Way to load multiple environment variables into shell
I would use source ( . ) command with process substitution: . <(grep -e '^VAR_1=' -e '^VAR_2=' .env). or . <(grep '^VAR_[12]=' .env)...
Read more >Using several .env files within my app (general and testing)
Hi, my question is related with the .env files. Is possible to have multiple .env files within the same application? How to know...
Read more >Using multiple .env files. - Prisma
One solution is to have multiple .env files which each represent different environments. In practice this means you create a file for each...
Read more >How To Use .env Variables In package.json - GenUI
It's common to need access to your environment variables in multiple places. Your code, your build scripts, and your pipeline may all need...
Read more >Environment variables in Expo
This approach this plugin will work well with environment variables set in your shell process, but it won't automatically load .env files.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mvastola so like this? https://github.com/keithmorris/node-dotenv-extended/pull/50
I was about to post this same feature request. The idea would be to allow for multiple layers of defaults/settings, as provided by
dotenv-flow
(which is fairly popular) as well as similar modules.These other modules, however, aren’t easily made compatible with
dotenv-extended
, however, without allowing the overriding of values already in the environment. (Or otherwise by saving the original environment and re-applying it after the changes in this module.)Implementing this feature a really simple change as well. The vast majority of the change is simply updating
src/index.js
to sayBeyond that, pretty much only CLI argument parsing would need to be tweaked, and documentation would need to be updated.