dotenv-hs
dotenv-hs copied to clipboard
dotenv picks the first instead of the last value
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