fix: trying to fix launching with globals

This commit is contained in:
Andreas Gammelgaard Damsbo 2026-03-12 11:32:06 +01:00
commit 95fc0a4d5f
No known key found for this signature in database
3 changed files with 20 additions and 9 deletions

View file

@ -1 +1 @@
hosted_version <- function()'v26.3.3-260311'
hosted_version <- function()'v26.3.3-260312'

View file

@ -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) {