dotenv
dotenv copied to clipboard
Does not resolve Environment Variables
Hey,
one of the nice features of environment files is that they can build upon the existing environment:
export SEARCH_DIR=$PWD/files
The expected behavior would be that the resulting SEARCH_DIR environment variable would contain the full path to the desired directory. Instead the result is "$PWD/files". Without this feature .env files are utterly useless when developing code on different machines with different directory structures, because one needs to manually adjust the file for every machine.
Kind regards, ju6ge
I think this package relies upon Sys.setenv
. However, from what I can tell, it's not possible to get Sys.setenv
to expand $PWD
. See this discussion on the RStudio forum.
In order to solve this, I think one would need to parse the contents of .env
to get each $
reference. Then you could reassemble the contents with Sys.getenv
evaluating each $
reference. Not sure if that'd slow things down too much or risk creating other bugs.