Skip to content

Commit

Permalink
Not providing creds now throws an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
andodet committed Mar 31, 2020
1 parent e51d590 commit 15ee2d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Description: More about what it does (maybe more than one line)
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.0.2
RoxygenNote: 7.1.0
Imports:
magrittr,
httr,
Expand Down
8 changes: 5 additions & 3 deletions R/citymappr_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#'
#' @export
citymappr_setup <- function(config_file = "~/.citymappr",
api_token = "",
api_token = NULL,
echo = FALSE) {

if (file.exists(config_file)) {
Expand All @@ -38,11 +38,13 @@ citymappr_setup <- function(config_file = "~/.citymappr",

Sys.setenv(CITYMAPPER_API_TOKEN = config[,"api_token"])

} else {

} else if(!is.null(api_token)) {
Sys.setenv(CITYMAPPER_API_TOKEN = api_token)
} else {
stop("No config file or token provided. Please provide one. Use `?citymappr_setup` for help")
}

# Print token if verbose
if (echo) {
print(toJSON(as.list(Sys.getenv(c("CITYMAPPER_API_TOKEN")))))
}
Expand Down
2 changes: 1 addition & 1 deletion man/citymappr_setup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 15ee2d1

Please sign in to comment.