File: servers-deprec.R

package info (click to toggle)
r-cran-rsconnect 1.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,044 kB
  • sloc: python: 185; sh: 13; makefile: 5
file content (49 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#' Discover servers automatically
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function has never worked usefully, so has been removed.
#'
#' @export
#' @keywords internal
discoverServers <- function(quiet = FALSE) {
  lifecycle::deprecate_warn("1.0.0", "discoverServers()")

  discovered <- getOption("rsconnect.local_servers", "http://localhost:3939/__api__")

  # get the URLs of the known servers, and silently add any that aren't yet
  # present
  existing <- servers()[, "url"]
  introduced <- setdiff(discovered, existing)
  lapply(introduced, function(url) { addServer(url, quiet = TRUE) })

  if (!quiet && length(introduced) > 0) {
    message("Discovered ", length(introduced),
            (if (length(introduced) == 1) "server" else "servers"), ":")
    lapply(introduced, message)
  } else if (!quiet) {
    message("No new servers found.")
  }
  invisible(introduced)
}

#' Add a server
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function does the same thing as [addServer()] so has been removed.
#'
#' @export
#' @inheritParams addServer
#' @keywords internal
addConnectServer <- function(url, name = NULL, certificate = NULL, quiet = FALSE) {
  lifecycle::deprecate_warn("1.0.0", "addConnectServer()", "addServer()")
  addServer(
    ensureConnectServerUrl(url),
    name = name,
    certificate = certificate,
    quiet = quiet
  )
}