Learn R Programming

dotenv (version 1.0.3)

dotenv-package: Load configuration parameters from .env into environment variables

Description

It has become a practice to store configuration parameters related to a project, in a hidden file called .env, in the working directory of a project, and then set them as environment variables.

Arguments

Details

This package loads the variables defined in the .env file in the current working directory (as reported by getwd), 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)` code at the beginning of your R script.

Alternatively a dotenv::load_dot_env() call can be used to load variables from arbitrary files.

The format of the .env file is also a valid unix shell file format, so e.g. in bash the environment variables can also be set by running source .env.

See load_dot_env for the exact file format.

See Also

load_dot_env