fix: изменен пайплайн конфигов во избежания ошибок в работе
This commit is contained in:
2
app.R
2
app.R
@@ -34,7 +34,7 @@ box::use(
|
|||||||
HEADER_TEXT <- sprintf("%s (%s)", config::get("form_name"), config::get("form_app_version"))
|
HEADER_TEXT <- sprintf("%s (%s)", config::get("form_name"), config::get("form_app_version"))
|
||||||
|
|
||||||
# sadasdasdasdasdas
|
# 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])
|
box::use(enabled/enabled_schemes[enabled_schemes])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,13 @@ default:
|
|||||||
form_app_version: 0.15.0
|
form_app_version: 0.15.0
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
form_db_path: db
|
form_app_configure_path: "."
|
||||||
form_configs_path: configs
|
|
||||||
form_auth_enabled: true
|
form_auth_enabled: true
|
||||||
form_id: new_form
|
form_id: new_form
|
||||||
form_name: NEW FORMY
|
form_name: NEW FORMY
|
||||||
|
|
||||||
devel:
|
devel:
|
||||||
form_db_path: _devel/db
|
form_app_configure_path: _devel
|
||||||
form_configs_path: _devel/configs
|
|
||||||
form_auth_enabled: false
|
form_auth_enabled: false
|
||||||
form_id: new_form
|
form_id: new_form
|
||||||
form_name: NEW FORMY
|
form_name: NEW FORMY
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
make_db_connection = function(scheme, where = "") {
|
make_db_connection = function(scheme, where = "") {
|
||||||
if (getOption("APP.DEBUG", FALSE)) message("=== DB CONNECT ", where)
|
if (getOption("APP.DEBUG", FALSE)) message("=== DB CONNECT ", where)
|
||||||
DBI::dbConnect(RSQLite::SQLite(), fs::path(
|
DBI::dbConnect(RSQLite::SQLite(), fs::path(
|
||||||
config::get("form_db_path"),
|
config::get("form_app_configure_path"),
|
||||||
|
"db",
|
||||||
scheme,
|
scheme,
|
||||||
ext = "sqlite"
|
ext = "sqlite"
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ set_global_options = function(
|
|||||||
|
|
||||||
config_params_to_check <- c(
|
config_params_to_check <- c(
|
||||||
"form_app_version",
|
"form_app_version",
|
||||||
"form_db_path",
|
"form_app_configure_path",
|
||||||
"form_configs_path",
|
|
||||||
"form_auth_enabled",
|
"form_auth_enabled",
|
||||||
"form_id",
|
"form_id",
|
||||||
"form_name"
|
"form_name"
|
||||||
@@ -41,22 +40,22 @@ check_and_init_scheme = function() {
|
|||||||
|
|
||||||
cli::cli_inform(c("*" = "проверка схемы..."))
|
cli::cli_inform(c("*" = "проверка схемы..."))
|
||||||
|
|
||||||
options(box.path = config::get("form_configs_path"))
|
options(box.path = config::get("form_app_configure_path"))
|
||||||
box::use(enabled/enabled_schemes[enabled_schemes])
|
box::use(configs/enabled_schemes[enabled_schemes])
|
||||||
|
|
||||||
files_to_watch <- c(
|
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/scheme_generator.R",
|
||||||
"modules/utils.R"
|
"modules/utils.R"
|
||||||
)
|
)
|
||||||
|
|
||||||
scheme_names <- enabled_schemes
|
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)
|
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)])))
|
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"
|
hash_file <- "temp/schema_hash.rds"
|
||||||
|
|
||||||
@@ -99,7 +98,8 @@ init_scheme = function(scheme_file) {
|
|||||||
modules/scheme_generator[scheme_R6]
|
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("Инициализация схемы")
|
cli::cli_h1("Инициализация схемы")
|
||||||
schms <- purrr::map2(
|
schms <- purrr::map2(
|
||||||
|
|||||||
Reference in New Issue
Block a user