R/util-get_credentials.R

Defines functions get_credentials

Documented in get_credentials

#' Read BacDive Login Credentials from .Renviron
#'
#' @return A vector or the two character strings `BacDive_email`
#'   and `BacDive_password` representing those two environment variables.
#' @keywords internal
get_credentials <- function() {
  readRenviron(construct_Renviron_path())

  id <- Sys.getenv("BacDive_email")
  pw <- Sys.getenv("BacDive_password")

  if (!nzchar(id) | !nzchar(pw)) {
    warning("BacDive login credentials not set completely.\n
             Please run `BacDiveR::prepare_Renviron()`.")
  } else {
    c(id, pw)
  }
}
TIBHannover/BacDiveR documentation built on June 2, 2022, 2:51 p.m.