Load configuration from a '.env' file, that is in the current working directory, into environment variables.
This package loads the variables defined in the
in the current working directory (as reported by
and sets them as environment variables.
This happens automatically when the
dotenv package is loaded,
so the typical use-case is to just put a
library(dotenv) call at the
beginning of your R script.
dotenv::load_dot_env() call can be used
to load variables from arbitrary files.
You can simply put
at the beginning of your script, to load the environment variables defined
.env in the current working directory.
.env file is parsed line by line, and line is expected
to have one of the following formats:
VARIABLE=value VARIABLE2="quoted value" VARIABLE3='another quoted variable' # Comment line export EXPORTED="exported variable" export EXPORTED2=another
In more details:
exportis ignored, to keep the file compatible with Unix shells.
#, without any leading whitespace. You cannot mix variable definitions and comments in the same line.
It is suggested to keep the file in a form that is parsed the
same way with
bash (or other shells).