From b35d62649a76c63fb02ccbe111f7857d387e6866 Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Mon, 13 Jan 2020 13:15:37 -0500 Subject: [PATCH 1/3] refactor resolvePrefix --- R/utils.R | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/R/utils.R b/R/utils.R index 450040c0..daad10ed 100644 --- a/R/utils.R +++ b/R/utils.R @@ -463,16 +463,19 @@ resolve_prefix <- function(prefix, environment_var, base_pathname) { return(prefix) } else { + # Check environment variables prefix_env <- Sys.getenv(environment_var) - if (prefix_env != "") { + env_base_pathname <- Sys.getenv("DASH_URL_BASE_PATHNAME") + app_name <- Sys.getenv("DASH_APP_NAME") + + else if (prefix_env != "") return(prefix_env) - } else { - env_base_pathname <- Sys.getenv("DASH_URL_BASE_PATHNAME") - if (env_base_pathname != "") - return(env_base_pathname) - else - return(base_pathname) - } + else if (app_name != "") + return(sprintf("/%s/", app_name)) + else if (env_base_pathname != "") + return(env_base_pathname) + else + return(base_pathname) } } From c07483409a766785ce9aa23e77ba3303a61eda7e Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Mon, 13 Jan 2020 13:27:23 -0500 Subject: [PATCH 2/3] camel case resolve_prefix --- R/dash.R | 4 ++-- R/utils.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/dash.R b/R/dash.R index ba122302..c9d32aec 100644 --- a/R/dash.R +++ b/R/dash.R @@ -213,8 +213,8 @@ Dash <- R6::R6Class( private$in_viewer <- FALSE # config options - self$config$routes_pathname_prefix <- resolve_prefix(routes_pathname_prefix, "DASH_ROUTES_PATHNAME_PREFIX", url_base_pathname) - self$config$requests_pathname_prefix <- resolve_prefix(requests_pathname_prefix, "DASH_REQUESTS_PATHNAME_PREFIX", url_base_pathname) + self$config$routes_pathname_prefix <- resolvePrefix(routes_pathname_prefix, "DASH_ROUTES_PATHNAME_PREFIX", url_base_pathname) + self$config$requests_pathname_prefix <- resolvePrefix(requests_pathname_prefix, "DASH_REQUESTS_PATHNAME_PREFIX", url_base_pathname) self$config$external_scripts <- external_scripts self$config$external_stylesheets <- external_stylesheets diff --git a/R/utils.R b/R/utils.R index daad10ed..b68655be 100644 --- a/R/utils.R +++ b/R/utils.R @@ -457,7 +457,7 @@ valid_seq <- function(params) { } } -resolve_prefix <- function(prefix, environment_var, base_pathname) { +resolvePrefix <- function(prefix, environment_var, base_pathname) { if (!(is.null(prefix))) { assertthat::assert_that(is.character(prefix)) From da2db1a16fd2a6e5912da23459ee486ec8b8add1 Mon Sep 17 00:00:00 2001 From: HammadTheOne <30986043+HammadTheOne@users.noreply.github.com> Date: Mon, 13 Jan 2020 21:41:27 -0500 Subject: [PATCH 3/3] Update R/utils.R Fixes conditional statement to resolve installation error. --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index b68655be..ae0ed9ef 100644 --- a/R/utils.R +++ b/R/utils.R @@ -468,7 +468,7 @@ resolvePrefix <- function(prefix, environment_var, base_pathname) { env_base_pathname <- Sys.getenv("DASH_URL_BASE_PATHNAME") app_name <- Sys.getenv("DASH_APP_NAME") - else if (prefix_env != "") + if (prefix_env != "") return(prefix_env) else if (app_name != "") return(sprintf("/%s/", app_name))