get_config: Search for config files and return variable / value pairs as...

View source: R/get_config.R

get_configR Documentation

Search for config files and return variable / value pairs as a list.

Description

configulaR currently supports only .env files. 'get_config' will search if the speficied directory and its parent a '.env' file. If no file is found, a empty list is returned.

Usage

get_config(path = NULL)

Arguments

path

a path from where a config if searched for. Parent directories will be evaluated if no config file is found is the specified directory. If NULL, the current directory will be taken as default.

Details

## Env file:

Simply create a .env text file on your repository's root directory in the form:

DEBUG=True
TEMPLATE_DEBUG=True
SECRET_KEY=ARANDOMSECRETKEY
DATABASE_URL=mysql://myuser:mypassword@myhost/mydatabase
PERCENTILE=90
#COMMENTED=42

Value

a list with variables / values from config file. If no config file has been found, an empyt list is returned.

Examples

config <- get_config()
config

configulaR documentation built on June 8, 2025, 10:52 a.m.