feat: bring config file back

This commit is contained in:
2026-04-20 18:50:40 +03:00
parent 7a006f6d6b
commit ac75ab08c2
8 changed files with 84 additions and 35 deletions

View File

@@ -4,7 +4,11 @@
#' @param where text mark to distingiush calss
make_db_connection = function(scheme, where = "") {
if (getOption("APP.DEBUG", FALSE)) message("=== DB CONNECT ", where)
DBI::dbConnect(RSQLite::SQLite(), fs::path("db", scheme, ext = "sqlite"))
DBI::dbConnect(RSQLite::SQLite(), fs::path(
config::get("form_db_path"),
scheme,
ext = "sqlite"
))
}
#' @export
@@ -12,12 +16,14 @@ make_db_connection = function(scheme, where = "") {
#' Function to close connection to db, disigned to easy dubugging and
#' hide warnings.
close_db_connection = function(con, where = "") {
tryCatch(
expr = DBI::dbDisconnect(con),
error = function(e) print(e),
warning = function(w) if (getOption("APP.DEBUG", FALSE)) message("=!= ALREADY DISCONNECTED ", where),
finally = if (getOption("APP.DEBUG", FALSE)) message("=/= DB DISCONNECT ", where)
)
}
#' @export