refactor: инициация схемы - при загрузке модуля, вместо загрузки пакетов через library: box and namespacing
This commit is contained in:
29
app.R
29
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)
|
||||
shiny::runApp(app, launch.browser = TRUE)
|
||||
Reference in New Issue
Block a user