From d73699a1d182a6705fa87726e23224a3e3e2d992 Mon Sep 17 00:00:00 2001 From: drdolgovvv Date: Mon, 15 Jun 2026 16:40:26 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D1=81=D1=85=D0=B5=D0=BC=D1=8B=20-?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B5=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F,=20=D0=B2?= =?UTF-8?q?=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=B7=D0=BA=D0=B8=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20library:=20box=20and=20name?= =?UTF-8?q?spacing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/modules/global_options.R | 19 +++++++++++++------ app.R | 29 +++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) 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