diff --git a/R/modules/global_options.R b/R/modules/global_options.R index 50821ea..0d7f69f 100644 --- a/R/modules/global_options.R +++ b/R/modules/global_options.R @@ -1,10 +1,16 @@ +.on_load = function(ns) { + + check_and_init_scheme() + +} + #' @export #' @description костыли для упрощения работы себе set_global_options = function( SYMBOL_DELIM = "; ", APP.DEBUG = FALSE, - shiny.host = "127.0.0.1", - shiny.port = 1338, + # shiny.host = "127.0.0.1", + # shiny.port = 1338, ... ) { @@ -29,9 +35,8 @@ set_global_options = function( SYMBOL_DELIM = SYMBOL_DELIM, # form.db_path = config::get("form_db_path"), APP.DEBUG = APP.DEBUG, - # APP.FILE_DB = APP.FILE_DB, - shiny.host = shiny.host, - shiny.port = shiny.port, + # shiny.host = shiny.host, + # shiny.port = shiny.port, ... ) } @@ -45,7 +50,9 @@ check_and_init_scheme = function() { cli::cli_inform(c("*" = "проверка схемы...")) options(box.path = here::here()) - box::use(R/modules/db[local_db_backup]) + box::use( + R/modules/db[local_db_backup] + ) # список файлов, изменение которых, приведут к переинициализиации схемы files_to_watch <- c( diff --git a/app.R b/app.R index c597d8c..ccc3bcd 100644 --- a/app.R +++ b/app.R @@ -1,16 +1,12 @@ -suppressPackageStartupMessages({ - library(DBI) - library(tidyr) - library(dplyr) - library(purrr) - library(magrittr) - library(shiny) - library(bslib) - library(shinymanager) -}) # SOURCE FILES ============================ +# packages box::purge_cache() +box::use( + bslib[...], + shiny[...] +) +# modules box::use( R/modules/utils, R/modules/global_options, @@ -22,15 +18,13 @@ box::use( R/modules/data_manipulations[is_this_empty_value] ) -# global settings: +# set global settings: global_options$set_global_options( shiny.host = "0.0.0.0", + shiny.port = 1338, APP.DEBUG = FALSE ) -# init: -global_options$check_and_init_scheme() - # global vars: box::use( R/modules/global_options[AUTH_ENABLED] @@ -118,7 +112,7 @@ server <- function(input, output, session) { res_auth <- if (AUTH_ENABLED) { # check_credentials directly on sqlite db shinymanager::secure_server( - check_credentials = check_credentials( + check_credentials = shinymanager::check_credentials( db = "auth.sqlite", passphrase = Sys.getenv("AUTH_DB_KEY") ), @@ -1373,7 +1367,6 @@ server <- function(input, output, session) { } +app <- shiny::shinyApp(ui = ui, server = server) -app <- shinyApp(ui = ui, server = server) - -runApp(app, launch.browser = TRUE) \ No newline at end of file +shiny::runApp(app, launch.browser = TRUE) \ No newline at end of file