feat: определение активный схем - в файле конфига

This commit is contained in:
2026-04-23 11:57:50 +03:00
parent 696f2e3ac8
commit 7b6cbc67e4
4 changed files with 14 additions and 16 deletions

9
app.R
View File

@@ -22,7 +22,6 @@ box::use(
global_options$set_global_options( global_options$set_global_options(
shiny.host = "0.0.0.0" shiny.host = "0.0.0.0"
) )
global_options$check_and_init_scheme() global_options$check_and_init_scheme()
# global vars # global vars
@@ -37,9 +36,11 @@ box::use(app/tasks)
# SETTINGS ================================ # SETTINGS ================================
HEADER_TEXT <- config::get("form_name") HEADER_TEXT <- config::get("form_name")
# sadasdasdasdasdas # refactor LATER ---------
options(box.path = config::get("form_app_configure_path")) vv <- unlist(config::get()$form_schemes)
box::use(configs/enabled_schemes[enabled_schemes]) enabled_schemes <- names(vv)
vvvv <- unname(vv)
names(enabled_schemes) <- vvvv
# CHECK FOR PANDOC # CHECK FOR PANDOC
# TEMP ! NEED TO HANDLE # TEMP ! NEED TO HANDLE

View File

@@ -6,8 +6,12 @@ default:
prod: prod:
form_app_configure_path: "." form_app_configure_path: "."
form_auth_enabled: false form_auth_enabled: false
form_schemes:
example_of_scheme: Тестовая база данных
devel: devel:
form_app_configure_path: _devel/antifib form_app_configure_path: _devel/antifib
form_auth_enabled: false form_auth_enabled: false
form_app_version: 0.16.0 dev form_app_version: 0.16.0 dev
form_schemes:
antifib: антифибротическая

View File

@@ -1,4 +0,0 @@
#' @export
enabled_schemes <- c(
`Тестовая база данных` = "example_of_scheme"
)

View File

@@ -43,17 +43,14 @@ check_and_init_scheme = function() {
options(box.path = here::here()) options(box.path = here::here())
box::use(modules/db[local_db_backup]) 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( files_to_watch <- c(
fs::path(config::get("form_app_configure_path"), "configs", "enabled_schemes.R"), "config.yml",
"modules/scheme_generator.R", "modules/scheme_generator.R",
"modules/utils.R" "modules/utils.R"
) )
scheme_names <- enabled_schemes scheme_names <- names(config::get()$form_schemes)
scheme_file <- paste0(config::get("form_app_configure_path"), "/configs/schemas/", scheme_names, ".xlsx") scheme_file <- paste0(config::get("form_app_configure_path"), "/configs/schemas/", scheme_names, ".xlsx")
scheme_file <- stats::setNames(scheme_file, scheme_names) scheme_file <- stats::setNames(scheme_file, scheme_names)