get_current_config: Return path to the '{golem}' config-file

View source: R/config.R

get_current_configR Documentation

Return path to the {golem} config-file

Description

This function tries to find the path to the {golem} config-file currently used. If the config-file is not found, the user is asked if they want to set parts of the {golem} skeleton. This includes default versions of "R/app_config" and "inst/golem-config.yml" (assuming that the user tries to convert the directory to a {golem} based shiny App).

Usage

get_current_config(path = getwd())

Arguments

path

character string giving the path to start looking for the config; the usual value is the {golem}-package top-level directory but a user supplied config is now supported (see Details for how to use this feature).

Details

In most cases this function simply returns the path to the default golem-config file located under "inst/golem-config.yml". That config comes in yml-format, see the Engineering Production-Grade Shiny Apps for further details on its format and how to set options therein.

Advanced app developers may benefit from having an additional user config-file. This is achieved by copying the file to the new location and setting a new path pointing to this file. The path is altered inside the app_sys()-call of the file "R/app_config.R" to point to the (relative to ⁠inst/⁠) location of the user-config i.e. change

# Modify this if your config file is somewhere else
file = app_sys("golem-config.yml")

to

# Modify this if your config file is somewhere else
file = app_sys("configs/user-golem-config.yml")

NOTE

  • the path to the config is changed relative to inst/ from inst/golem-config.yml to inst/configs/user-golem-config.yml

  • if both, the default config and user config files exists (and the path is set correctly for the latter), an error is thrown due to ambiguity: in this case simply rename/delete the default config or change the entry in "R/app_config.R" back to app_sys("golem-config.yml") to point to the default location

Value

character string giving the path to the {golem} config-file


golem documentation built on Sept. 11, 2024, 7:54 p.m.