R/app_config.R

Defines functions get_golem_config app_sys

#' Access files in the current app
#' 
#' @param ... Character vector specifying directory.
#' @noRd
#' 
app_sys <- function(...) {
  
  system.file(..., package = "spacex.app")
  
}

#' Read App Config
#' 
#' @param value Value to retrieve from the config file. 
#' @param config R_CONFIG_ACTIVE value. 
#' @param use_parent Logical, scan the parent directory for config file.
#' @noRd
#' 
get_golem_config <- function(value,
                             config = Sys.getenv("R_CONFIG_ACTIVE", "default"),
                             use_parent = TRUE
) {
  
  config::get(
    value = value, 
    config = config, 
    file = app_sys("golem-config.yml"), 
    use_parent = use_parent
  )
  
}
James-G-Hill/SpaceX-R-Shiny-Application documentation built on Nov. 11, 2021, 11:26 p.m.