Skip to content
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

Issue 175: Command does not load dotenv files if some do not exist [2] #187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

egasimov
Copy link

@egasimov egasimov commented Jun 12, 2022

Hi, The following PR is intended to resolve issue-175 .

When the any of the passed fileNames do not exist, it just silently stops the process of 'load env files'
and start to execute the command provided.

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
And decided to make small PR.

Current behaviour:
Silently stopping the process of 'load env files' and continuing to execute the command provided.

$ cat .env
FOO="Using .env"

$ godotenv -f ".env,.env.doesnotexist" env | grep FOO
FOO=Using .env

$ godotenv -f ".env.doesnotexist,.env" env | grep FOO
# FOO does not get set

Considered behaviour:
When some of the fileNames do not exist, then print the error message: "File: ${fileName} not found" to stderr
and continue to load the remaining fileNames.
After the load process has been finished, continue to execute command provided.

$ cat .env
FOO="Using .env"

$ godotenv -f ".env,.env.doesnotexist" env | grep FOO
FOO=Using .env

$ godotenv -f ".env.doesnotexist,.env" env | grep FOO
File: `.env.doesnotexist` not found
FOO=Using .env

@egasimov egasimov changed the title Issue 175: Command does not load dotenv files if some do not exist Issue 175: Command does not load dotenv files if some do not exist [2] Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command does not load dotenv files if some do not exist
1 participant