mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 12:37:30 +02:00
fix: trying to fix launching with globals
This commit is contained in:
parent
a73f8b1ba3
commit
95fc0a4d5f
3 changed files with 20 additions and 9 deletions
|
|
@ -1 +1 @@
|
|||
hosted_version <- function()'v26.3.3-260311'
|
||||
hosted_version <- function()'v26.3.3-260312'
|
||||
|
|
|
|||
|
|
@ -43,14 +43,15 @@ launch_FreesearchR <- function(include_globalenv = TRUE,
|
|||
|
||||
## Helper to set env variables
|
||||
get_config <- function(var_name, default = NULL) {
|
||||
# First check environment variables (set by Docker)
|
||||
val <- Sys.getenv(var_name, unset = NA)
|
||||
val <- Sys.getenv(var_name, unset = NA_character_)
|
||||
|
||||
if (!is.na(val) && nzchar(val)) {
|
||||
# Only use env var if it is explicitly set and non-empty
|
||||
if (!is.na(val) && nzchar(trimws(val))) {
|
||||
if (is.logical(default)) return(to_logical(val))
|
||||
if (is.numeric(default)) return(as.numeric(val))
|
||||
return(val)
|
||||
}
|
||||
|
||||
# Fall back to default (can be overridden when launching from R)
|
||||
if (!is.null(default)) {
|
||||
return(default)
|
||||
}
|
||||
|
|
@ -58,6 +59,16 @@ get_config <- function(var_name, default = NULL) {
|
|||
stop(paste("Required config variable not set:", var_name))
|
||||
}
|
||||
|
||||
to_logical <- function(x) {
|
||||
result <- switch(tolower(trimws(as.character(x))),
|
||||
"true" = , "1" = , "yes" = TRUE,
|
||||
"false" = , "0" = , "no" = FALSE,
|
||||
NA
|
||||
)
|
||||
if (is.na(result)) stop(paste("Cannot coerce to logical:", x))
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
## File loader - based on the module, uses hard coded default values
|
||||
load_file <- function(path) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
\title{Easily launch the FreesearchR app}
|
||||
\usage{
|
||||
launch_FreesearchR(
|
||||
inlcude_globalenv = TRUE,
|
||||
include_globalenv = TRUE,
|
||||
data_limit_default = 1000,
|
||||
data_limit_upper = 1e+05,
|
||||
data_limit_lower = 1,
|
||||
|
|
@ -13,6 +13,9 @@ launch_FreesearchR(
|
|||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{include_globalenv}{flag to include global env (local data) as option
|
||||
when loading data}
|
||||
|
||||
\item{data_limit_default}{default data set observations limit}
|
||||
|
||||
\item{data_limit_upper}{data set observations upper limit}
|
||||
|
|
@ -20,9 +23,6 @@ launch_FreesearchR(
|
|||
\item{data_limit_lower}{data set observations lower limit}
|
||||
|
||||
\item{...}{passed on to \code{shiny::runApp()}}
|
||||
|
||||
\item{include_globalenv}{flag to include global env (local data) as option
|
||||
when loading data}
|
||||
}
|
||||
\value{
|
||||
shiny app
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue