-
-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress errors of missing .env file for production #58
Comments
Let's put aside what's normal for production and what's not. We do try/catch the error and politely console.log it as you've described because it's important to let someone know why dotenv may not be working. If we remove the log line, people are left to figure it out themselves (dig into source, add their own logs, etc.). We could add something like debug but then dotenv would no longer be dependency-free. What's a solution that satisfies all of these concerns? |
Many thanks for the swift reply. I can only think of 2 possible solutions.
Hope that makes sense, |
Would a pull request help to get this going? |
@jmike those always seem to push things along faster 😄 |
Since i have the same problem, i can volunteer for the PR if needed |
Took a stab at this in #62 |
Hey guys, It's great that there is a way to pass #dev
nodemon src/ --exec \"node --require dotenv/config --require babel-register\"
#prod (not recommended; build instead and then run without babel)
babel-node --require dotenv/config --require babel-register src/ The reason for not using Any ideas? |
@kachkaev I think you can use |
@calebboyd thanks for the hint, I did not know this trick existed. Looks like in v3.0.0 this is no longer the case though. Errors are not shown by default unless you pass a |
Production environments normally don't have a .env file. In these cases
require('dotenv').load()
prints the following error to console:Shouldn't these errors be suppressed or at least change into something less frightening?
The text was updated successfully, but these errors were encountered: