Skip to content
Open
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: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* Fixes #956, allowing a port to be specified as an environment variable. User-provided ports must be between 1024 and 49151 (following [IANA guidelines](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml)) and may not be a known unsafe port. plumber will now throw an error if an invalid port is requested. (@shikokuchuo @gadenbuie #963)

* Added support for graphic devices provided by ragg and svglite (@thomasp85 #964)

* `parse_rds()`, `parse_feather()`, and `parse_parquet()` no longer writes data to disk during parsing (@thomasp85, #942)

* Fixed a bug where setting the `apiPath` option wouldn't be honored when running the app (@thomasp85, #836)

* Returning error messages are now turned off by default rather than being turned on if running interactively and turned off if not (@thomasp85, #962)

* New serializers
Expand Down
3 changes: 1 addition & 2 deletions R/plumber.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ Plumber <- R6Class(
old_wd <- setwd(dirname(private$filename))
on.exit({setwd(old_wd)}, add = TRUE)
}

if (isTRUE(docs_info$enabled)) {
mount_docs(
pr = self,
Expand All @@ -263,7 +262,7 @@ Plumber <- R6Class(
callback = swaggerCallback,
quiet = quiet
)
on.exit(unmount_docs(self, docs_info), add = TRUE)
#on.exit(unmount_docs(self, docs_info), add = TRUE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this still needs to be there as the docs will want to be mounted again on a followup run.

}

if (!isTRUE(quiet) && inform_debug && rlang::is_interactive()) {
Expand Down
12 changes: 8 additions & 4 deletions R/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ mount_openapi <- function(pr, api_url) {
break
}
}
pr$handle("GET", "/openapi.json", openapi_fun, serializer = serializer_unboxed_json())
path <- get_option_or_env("plumber.apiPath", "")
pr$handle("GET", paste0(path, "/openapi.json"), openapi_fun, serializer = serializer_unboxed_json())

invisible()
}
Expand Down Expand Up @@ -184,7 +185,7 @@ register_docs <- function(name, index, static = NULL) {
stopifnot(is.function(index))
if (!is.null(static)) stopifnot(is.function(static))

docs_root <- paste0("/__docs__/")
docs_root <- "/__docs__/"
docs_paths <- c("/index.html", "/")
mount_docs_func <- function(pr, api_url, ...) {
# Save initial extra argument values
Expand All @@ -210,8 +211,11 @@ register_docs <- function(name, index, static = NULL) {
message("Overwritting existing `", docs_root, "` mount")
message("")
}

pr$mount(docs_root, docs_router)

pr$mount(
paste0(get_option_or_env("plumber.apiPath", ""), docs_root),
docs_router
)

# add legacy swagger redirects (RStudio Connect)
redirect_info <- swagger_redirects()
Expand Down
Loading