R/rs_auth.R

Defines functions rs_check_auth rs_auth

Documented in rs_auth

#' Set Ringostat API key
#'
#' @param api_key Your API key
#'
#' @return No return value, called for side effects
#' @export
#'
rs_auth <- function(api_key) {
  Sys.setenv('RS_API_KEY' = api_key)
  cli_alert_success("API token was set successfully")
}

rs_check_auth <- function() {
  if (  identical(Sys.getenv("RS_API_KEY"), "") ) cli_abort("You dont authorize, please set RS_API_KEY variable, or use rs_auth().")
}

Try the ringostat package in your browser

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

ringostat documentation built on Aug. 12, 2022, 5:06 p.m.