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
I was wondering if Python's dotenv behaved in the same way. Looks like Python's dotenv is different from Haskell's but equal to bashes source:
$ pip install python-dotenv
...
$ file .local/bin/dotenv
.local/bin/dotenv: Python script, ASCII text executable
$ .local/bin/dotenv -f.env run ./my_script.hs
third
second
Hello @rudymatela This issue and your PR (#122) have been open for a very long time. Let's try to wrap it up.
I like the idea to have tools working in a similar way and I would like to see how other dotenv tools behave. I'll ask a member in my team to take a look at this and report their findings.
Hello! @anddriex is going to give a look at this issue to replicate something similar to what other dotenv tools are doing.
Solved by #161 thanks for the contribution @anddriex and thankd @rudymatela for reporting it!