README.md

Project Status: Active - The project has reached a stable, usable
state and is being actively
developed. R build
status CRAN RStudio mirror
downloads Coverage
Status

dotenv — Load environment variables from .env

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) call at the beginning of your R script.

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

Installation

install.packages("dotenv")

Usage

You can simply put

library(dotenv)

at the beginning of your script, to load the environment variables defined in .env in the current working directory.

File format

The .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:

It is suggested to keep the file in a form that is parsed the same way with dotenv and bash (or other shells).



gaborcsardi/dotenv documentation built on Oct. 5, 2022, 1:30 a.m.