feat: bring config file back
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user