-
Notifications
You must be signed in to change notification settings - Fork 408
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
Command does not load dotenv files if some do not exist #175
Comments
Hi @evandam, I have looked at the godotenv project and came to the following conclusion that confirms your assumption. When the any of the passed fileNames do not exist, it just silently stops the process of 'load env files' I believe that behaviour might lead to unexpected results and assumptions which might affect the correctness of the system that utilizes the environment variables using godotenv command Current behaviour:
Considered behaviour:
|
@egasimov thanks a lot for the PR but I don't think it should error out. It'd be better if it was just skipping whatever file not existing but still load the files found. This is usually the pattern with dotenv. |
Agreed with @scalp42. This way we can handle "optional" dotenv files like a .env.local that a developer may or may not have when they run in their environments. |
@scalp42 welcome, Agree with you, my previous change may also introduce breaking changes for the systems that already use it somehow. After considering your thoughts(@scalp42, @evandam ), I made another PR that simply loads all the files which do exist and prints stderr about the filenames which are missing. |
Hi @joho, I noticed some unexpected behavior when using
godotenv
from the command line. When passing multiple .env files, if one listed first does not exist, it looks like it skips processing the rest.For example:
Any thoughts on a solution for this?
Thanks in advance!
The text was updated successfully, but these errors were encountered: