Skip to contents

This function initializes the configuration setup by creating the configuration file, encrypted configuration file, and configuration template file.

It also sets the R_CONFIG_FILE environment variable to the path of the configuration file.

Usage

cfg_init(
  path = here::here("inst/config"),
  cfg = list(default = list(key = "value")),
  cfg_file = "config.yml",
  cfg_file_encrypted = "config.encrypted.yml",
  cfg_file_template = "config.template.yml",
  encryption_key_name = "NOCLOCKS_ENCRYPTION_KEY",
  overwrite = FALSE,
  symlink = TRUE,
  ...
)

Arguments

path

Path to the configuration directory. Defaults to inst/config.

cfg

A list of configuration settings. Defaults to an empty list.

cfg_file

Path to the configuration file. Defaults to config.yml.

cfg_file_encrypted

Path to the encrypted configuration file. Defaults to config.encrypted.yml.

cfg_file_template

Path to the configuration template file. Defaults to config.template.yml.

encryption_key_name

The name of the environment variable that contains the encryption key. Defaults to NOCLOCKS_ENCRYPTION_KEY.

overwrite

Overwrite the existing configuration files. Defaults to FALSE.

Create a symlink to the configuration file. Defaults to TRUE.

...

Additional arguments passed to other functions.

Value

Invisibly returns the configuration settings.

Details

The cfg_init() function creates the following files:

  • config.yml: The configuration file containing the configuration settings.

  • config.encrypted.yml: The encrypted configuration file.

  • config.template.yml: The configuration template file.

  • .gitignore: The gitignore file to ignore the configuration files.

  • README.md: The README file with instructions on how to use the configuration files.

See also