Ability to override process.env
See original GitHub issueIn a case of using Create-React-App, it seems they are doing something funky with their process
variable. That is, if you access process via require or import, it will be null. So this lib will never get the env vars set in by this app.
Would you mind adding an extra param for get(envVar, default, container)
that allows us to pass in our own process.env
as the 3rd param?
I could do a PR if you prefer that route.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
add 'replace' option to overwrite existing process.env keys #115
hi the code ignores existing keys if already found in the process.env and does not overwrite them. for some cases that works fine,...
Read more >How to stub process.env in node.js? - Stack Overflow
I was able to get process.env to be stubed properly in my unit tests by cloning it and in a teardown method restoring...
Read more >Working with Environment Variables in Node.js - Twilio
Since process.env is a normal object, we can set/override the values very easily: process.env.
Read more >Node Environment Variables: Process env Node
Customizing a . env file can be done by writing the name of the environment variable we want to override at the start...
Read more >How to define TypeScript types for process.env to have auto ...
Typescript allows overriding ambient definitions of another module very simply by using a concept called « interfaces merging », thanks to which we...
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 Free
Top 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
Closing this @shawnmclean. Feel free to reopen if you need
@shawnmclean want to PR the removal of the
require
? I’ll merge and release it as aMINORPATCH release.