Command does not load dotenv files if some do not exist
Author: evandamCreated Apr 8, 2022Updated Jan 9, 2025
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:
$ 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 setAny thoughts on a solution for this?
Thanks in advance!
Source: joho/godotenv