diff --git a/R/context/set_config.R b/R/context/set_config.R index a2dcdd7..c16f8db 100644 --- a/R/context/set_config.R +++ b/R/context/set_config.R @@ -38,7 +38,7 @@ const set_config = function(configs = list()) { #' a type cast function expression invoke example as: #' ``as.logical``, ``as.double``, etc maybe required. #' -const get_config = function(name, default = NULL) { +const get_config = function(name, default = NULL, warn_msg = NULL) { const path = strsplit(name, "$", fixed = TRUE); const verbose = as.logical(getOption("verbose")); @@ -60,7 +60,16 @@ const get_config = function(name, default = NULL) { } } - return(config || default); + if (is.null(warn_msg)) { + return(config || default); + } else { + if (is.null(config)) { + echo_warning(warn_msg); + default; + } else { + config; + } + } } #' pull all configuration value from workflow registry