diff --git a/app.R b/app.R index 1efe5c4..121014c 100644 --- a/app.R +++ b/app.R @@ -34,7 +34,7 @@ box::use( HEADER_TEXT <- sprintf("%s (%s)", config::get("form_name"), config::get("form_app_version")) # sadasdasdasdasdas -options(box.path = config::get("form_configs_path")) +options(box.path = config::get("form_app_configure_path")) box::use(enabled/enabled_schemes[enabled_schemes]) diff --git a/config.yml b/config.yml index 7ec1182..2a91d68 100644 --- a/config.yml +++ b/config.yml @@ -2,15 +2,13 @@ default: form_app_version: 0.15.0 prod: - form_db_path: db - form_configs_path: configs + form_app_configure_path: "." form_auth_enabled: true form_id: new_form form_name: NEW FORMY devel: - form_db_path: _devel/db - form_configs_path: _devel/configs + form_app_configure_path: _devel form_auth_enabled: false form_id: new_form form_name: NEW FORMY diff --git a/configs/enabled/enabled_schemes.R b/configs/enabled_schemes.R similarity index 100% rename from configs/enabled/enabled_schemes.R rename to configs/enabled_schemes.R diff --git a/modules/db.R b/modules/db.R index 9be7a8e..fa7bc2c 100644 --- a/modules/db.R +++ b/modules/db.R @@ -5,7 +5,8 @@ make_db_connection = function(scheme, where = "") { if (getOption("APP.DEBUG", FALSE)) message("=== DB CONNECT ", where) DBI::dbConnect(RSQLite::SQLite(), fs::path( - config::get("form_db_path"), + config::get("form_app_configure_path"), + "db", scheme, ext = "sqlite" )) diff --git a/modules/global_options.R b/modules/global_options.R index 1455b76..5309db4 100644 --- a/modules/global_options.R +++ b/modules/global_options.R @@ -10,8 +10,7 @@ set_global_options = function( config_params_to_check <- c( "form_app_version", - "form_db_path", - "form_configs_path", + "form_app_configure_path", "form_auth_enabled", "form_id", "form_name" @@ -41,22 +40,22 @@ check_and_init_scheme = function() { cli::cli_inform(c("*" = "проверка схемы...")) - options(box.path = config::get("form_configs_path")) - box::use(enabled/enabled_schemes[enabled_schemes]) + 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_configs_path"), "enabled", "enabled_schemes.R"), + fs::path(config::get("form_app_configure_path"), "configs", "enabled_schemes.R"), "modules/scheme_generator.R", "modules/utils.R" ) scheme_names <- enabled_schemes - scheme_file <- paste0(config::get("form_configs_path"), "/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) if (!all(file.exists(scheme_file))) cli::cli_abort(c("Отсутствуют файлы схем для следующих наименований:", paste("-", names(scheme_file)[!file.exists(scheme_file)]))) - db_files <- paste0(config::get("form_db_path"), "/", scheme_names, ".sqlite") + db_files <- paste0(config::get("form_app_configure_path"), "/db/", scheme_names, ".sqlite") hash_file <- "temp/schema_hash.rds" @@ -99,7 +98,8 @@ init_scheme = function(scheme_file) { modules/scheme_generator[scheme_R6] ) - if (!dir.exists(config::get("form_db_path"))) dir.create(config::get("form_db_path")) + db_path <- fs::path(config::get("form_app_configure_path"), "db") + if (!dir.exists(db_path)) dir.create(db_path) cli::cli_h1("Инициализация схемы") schms <- purrr::map2(