Skip to content

Commit

Permalink
Check in uploadRScript if credentials are blank
Browse files Browse the repository at this point in the history
Can happen if you set up a new machine and forget to update your .Renviron.
  • Loading branch information
chrisfacer committed Mar 27, 2023
1 parent 651e7e4 commit 62b3f88
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions R/DataMart.R
Expand Up @@ -519,10 +519,16 @@ uploadRScript <- function(r.code,
{
if (nzchar(send.to))
{
api.root = Sys.getenv(paste0("API_ROOT_", send.to))
company.secret = Sys.getenv(paste0("COMPANY_SECRET_", send.to))
client.id = Sys.getenv(paste0("CLIENT_ID_ ", send.to))
api.root <- Sys.getenv(paste0("API_ROOT_", send.to))
company.secret <- Sys.getenv(paste0("COMPANY_SECRET_", send.to))
client.id <- Sys.getenv(paste0("CLIENT_ID_ ", send.to))
}
credentials <- setNames(c(api.root, company.secret, client.id),
c("api.root", "company.secret", "client.id"))
missing.credentials <- which(!nzchar(credentials))
if (length(missing.credentials) > 0)
stop("Some of your API credentials are missing: ", paste0(names(credentials[missing.credentials]), collapse = ","))

if (missing(filename))
stop(substitute(filename), " argument required as ",
"filename to write in Displayr Drive is required.")
Expand Down

0 comments on commit 62b3f88

Please sign in to comment.