R/utils_envvars.R

Defines functions in_test set_envvar set_envvars

set_envvars <- function(envvars) {
  map_rows(envvars, set_envvar)
}

set_envvar <- function(envvar) {
  args <- list(envvar["value"])
  names(args) <- envvar["name"]
  if (!identical(as.character(envvar["value"]), "")) {
    do.call(what = Sys.setenv, args = args)
  }
  invisible()
}

in_test <- function() {
  Sys.getenv("TESTTHAT") == "true"
}

Try the targets package in your browser

Any scripts or data that you put into this service are public.

targets documentation built on Oct. 12, 2023, 5:07 p.m.