Skip to contents

Check that all entries in a config are valid.

Usage

validate_cfg(exp_keys = NULL, cfg_dir = NULL, cfg_name = NULL, cfg = NULL)

Arguments

exp_keys

A character vector of expected config keys or NULL for the default. Default: Keys as returned by get_cfg_template_keys()

cfg_dir

A character string specifying the config directory, or NULL for the default. Default: An OS-specific path for user configuration files in the user's home directory.

cfg_name

A character string specifying the config file name, or NULL for the default. Default: 'config.yml'

cfg

A list of nested lists, with 'leaf' nodes specifying configuration values. Default: The template config returned by generate_cfg_template()

Value

TRUE if the config is valid, FALSE otherwise.

Examples

# Validate the default config:
validate_cfg()
#> Warning: cannot open file '/home/runner/.config/R-dimex/config.yml': No such file or directory
#> Error in file(file, "rt", encoding = fileEncoding): cannot open the connection
# TODO: Add example of validating a custom config