question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to override process.env

See original GitHub issue

In 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
evanshortisscommented, Apr 11, 2019

Closing this @shawnmclean. Feel free to reopen if you need

1reaction
evanshortisscommented, Apr 1, 2019

@shawnmclean want to PR the removal of the require? I’ll merge and release it as a MINOR PATCH release.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found