Skip to contents

Ensures the settings YAML path is absolute and exists, using environment variables and code root as fallback.

Usage

parse_settings_path(settings_file, code_root = NULL)

Arguments

settings_file

character. Path to settings YAML file (can be relative or absolute).

code_root

character. Path to code root directory (used for relative resolution).

Value

character(1). Absolute path to settings YAML file.

Details

  • Prevents silent misconfiguration and enforces reproducibility.

  • Checks WEIGHTING_SETTINGS_PATH env var if not provided.

  • Converts relative paths to absolute using code root.

  • Stops with error if file does not exist or extension is wrong.

See also

scripts/000_run_weight_scripts.R

Other settings management: check_write_to_db(), get_settings(), parse_code_root(), parse_raw_data_root(), set_defaults(), update_data_root(), update_directories(), update_settings_pums_vars()

Examples

## Not run:
Sys.setenv(WEIGHTING_SETTINGS_PATH = "configs/examples/example_settings.yaml")
parse_settings_path("configs/example.yaml")
#> Error in parse_settings_path("configs/example.yaml"): could not find function "parse_settings_path"
## End(Not run)