R/get_apikey_from_Renviron.r

Defines functions get_apikey

Documented in get_apikey

#' Get value of algaebase API key from Environment variable
#' Return an error if variable not set.
#'
#' @export get_apikey
#' @return api key as character string (invisibly)

get_apikey <- function() {
  val <- Sys.getenv("ALGAEBASE_APIKEY")
  if (identical(val, "")) {
    stop("`ALGAEBASE_APIKEY` env var has not been set. Add it to your ~/.Renviron file")
  }
  invisible(val)
}

Try the algaeClassify package in your browser

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

algaeClassify documentation built on Nov. 22, 2023, 1:08 a.m.