Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/dash.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 12 additions & 9 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -457,22 +457,25 @@ 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))

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")

if (prefix_env != "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a slight change here to fix the conditional statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂ Yep, one too many else if statements here.

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)
}
}

Expand Down