dotenv-hs icon indicating copy to clipboard operation
dotenv-hs copied to clipboard

dotenv picks the first instead of the last value

Open rudymatela opened this issue 4 years ago • 1 comments

See:

$ cat > my_script.hs
#!/bin/bash
echo $FOO
echo $GOO
^D
$ cat > .env
#!/bin/sh
FOO=first
GOO=second
FOO=third
^D
$ dotenv -f.env ./my_script.hs 
first
second

I would expect for the result to be actually:

third
second

Now, that may be just a personal preference... However I justify it as it is less surprising for dotenv files to behave like shell scripts and have a preference for the last set value:

$ source .env
$ echo $FOO
third
$ echo $GOO
second

rudymatela avatar Apr 29 '20 15:04 rudymatela