Skip to contents

This function reads environment variables from a specified .env file and assigns them to variables in the R environment based on a data frame containing variable names, values, and checks for directories and files. It is designed to facilitate the management of environment variables in a structured and reproducible manner.

Usage

AssignEnvVars(EnvFile = ".env", EnvVarDT = NULL)

Arguments

EnvFile

Character string specifying the path to the .env file. Default is ".env". This file should contain environment variables in the format VAR_NAME=value.

EnvVarDT

A data frame or tibble containing the columns VarName, Value, CheckDir, and CheckFile. Each row specifies an environment variable, the name to assign it to, and whether to check if it is a directory or file. This structure allows for additional validation checks on the variables being imported.

Value

This function is used for its side effects of setting environment variables in the R environment. It assigns each variable from the .env file to the R environment with the name specified in the EnvVarDT data frame.

Author

Ahmed El-Gabbas