The config package makes it easy to manage environment specific
configuration values. For example, you might want to use distinct values
for development, testing, and production environments.
Installation
You can install the config package from CRAN by using:
install.packages("config")
Usage
To use config, create a file config.yml with default as well as
other arbitrary configurations. For example:
To read configuration values you call the config::get function, which
returns a list containing all of the values for the currently active
configuration:
The config::get() function takes an optional config argument which
determines which configuration to read values from (the “default”
configuration is used if none is specified).
config
The
configpackage makes it easy to manage environment specific configuration values. For example, you might want to use distinct values for development, testing, and production environments.Installation
You can install the
configpackage from CRAN by using:Usage
To use
config, create a fileconfig.ymlwith default as well as other arbitrary configurations. For example:config.yml
To read configuration values you call the
config::getfunction, which returns a list containing all of the values for the currently active configuration:R
You can also read a single value from the configuration as follows:
R
The
config::get()function takes an optionalconfigargument which determines which configuration to read values from (the “default” configuration is used if none is specified).Vignettes
See the package vignettes at https://rstudio.github.io/config/ for more examples and instructions for advanced usage, including:
configon Posit ConnectDo not attach the package using
library(config)We strongly recommend you use
config::get()rather than attaching the package usinglibrary(config).In fact, we strongly recommend you never use
library(config).The underlying reason is that the
get()andmerge()functions in{config}will mask these functions with the same names in base R.