load_dot_env {configulaR}R Documentation

Load environment variables from the specified file

Description

The file is parsed, 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

Usage

load_dot_env(fpath = ".env")

Arguments

fpath

The path to the '.env' config file

Details

Load variables defined in the given file, as environment variables.

Detailed specification:

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

Value

A named list of environment variables, where names are the variable names and values are the variable values

Examples

# Load from a file
tmp <- tempfile()

cat("dotenvexamplefoo=bar\n", file = tmp)
load_dot_env(tmp)

# Clean up
unlink(tmp)

[Package configulaR version 0.1.1 Index]