diff --git a/app.R b/app.R index 4c178f0..01d1d4a 100644 --- a/app.R +++ b/app.R @@ -22,7 +22,6 @@ box::use( global_options$set_global_options( shiny.host = "0.0.0.0" ) - global_options$check_and_init_scheme() # global vars @@ -37,9 +36,11 @@ box::use(app/tasks) # SETTINGS ================================ HEADER_TEXT <- config::get("form_name") -# sadasdasdasdasdas -options(box.path = config::get("form_app_configure_path")) -box::use(configs/enabled_schemes[enabled_schemes]) +# refactor LATER --------- +vv <- unlist(config::get()$form_schemes) +enabled_schemes <- names(vv) +vvvv <- unname(vv) +names(enabled_schemes) <- vvvv # CHECK FOR PANDOC # TEMP ! NEED TO HANDLE diff --git a/config.yml b/config.yml index 28e3c7d..5692b82 100644 --- a/config.yml +++ b/config.yml @@ -6,8 +6,12 @@ default: prod: form_app_configure_path: "." form_auth_enabled: false + form_schemes: + example_of_scheme: Тестовая база данных devel: form_app_configure_path: _devel/antifib form_auth_enabled: false - form_app_version: 0.16.0 dev \ No newline at end of file + form_app_version: 0.16.0 dev + form_schemes: + antifib: антифибротическая \ No newline at end of file diff --git a/configs/enabled_schemes.R b/configs/enabled_schemes.R deleted file mode 100644 index 568ef30..0000000 --- a/configs/enabled_schemes.R +++ /dev/null @@ -1,4 +0,0 @@ -#' @export -enabled_schemes <- c( - `Тестовая база данных` = "example_of_scheme" -) \ No newline at end of file diff --git a/modules/global_options.R b/modules/global_options.R index 2f06e4a..632bb79 100644 --- a/modules/global_options.R +++ b/modules/global_options.R @@ -43,19 +43,16 @@ check_and_init_scheme = function() { options(box.path = here::here()) box::use(modules/db[local_db_backup]) - options(box.path = config::get("form_app_configure_path")) - box::use(configs/enabled_schemes[enabled_schemes]) - # список файлов, изменение которых, приведут к переинициализиации схемы files_to_watch <- c( - fs::path(config::get("form_app_configure_path"), "configs", "enabled_schemes.R"), + "config.yml", "modules/scheme_generator.R", "modules/utils.R" ) - scheme_names <- enabled_schemes - scheme_file <- paste0(config::get("form_app_configure_path"), "/configs/schemas/", scheme_names, ".xlsx") - scheme_file <- stats::setNames(scheme_file, scheme_names) + scheme_names <- names(config::get()$form_schemes) + scheme_file <- paste0(config::get("form_app_configure_path"), "/configs/schemas/", scheme_names, ".xlsx") + scheme_file <- stats::setNames(scheme_file, scheme_names) if (!all(file.exists(scheme_file))) { cli::cli_abort(c("Отсутствуют файлы схем для следующих наименований:", paste("-", names(scheme_file)[!file.exists(scheme_file)])))