This would be cleaner with a helper like 

```R
find_first_env <- function(envs) {
  for(env in envs) {
    val <- Sys.getenv(env, unset = NA)
    if (!is.na(val)) return(val)
  }

  stop("Could not find env vars: ", paste0(envs, collapse = ", "),
    call. = FALSE)
}
```