R/wm_configuration.R

Defines functions wm_configuration

Documented in wm_configuration

#' @title wm_configuration
#' @description webmiddens settings
#' @export
#' @param path (character) path to set for the current midden
#' @param expire (numeric/integer) an expiration time (seconds)
#' @return nothing, sets path and expire settings
#' @examples \dontrun{
#' wm_configuration("foobar")
#' wm_configuration("foobar", expire = 6)
#' }
wm_configuration <- function(path, expire = NULL) {
  assert(path, "character")
  assert(expire, c("numeric", "integer"))
  mdenv$path <- path
  if (is.null(expire)) {
    expire <- Sys.getenv("WEBMIDDENS_EXPIRY_SEC")
    mdenv$expire <- expire
  } else {
    Sys.setenv(WEBMIDDENS_EXPIRY_SEC = expire)
  }
}
ropensci/webmiddens documentation built on Dec. 11, 2020, 9:03 p.m.