Skip to content

Commit

Permalink
use BOXR_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlyttle committed Jan 7, 2024
1 parent cd016a5 commit 4d4c23e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/setup_auth.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
use_token <- identical(Sys.getenv("BOXR_USE_TOKEN"), "true")

path_secret <- system.file("secret", "boxr-testing.json", package = "boxr")
env_secret <- "BOXR_PASSWORD"
env_secret <- "BOXR_KEY"

# NOTE 2024-01-07:
# - the key used with the deprecated gargle functions had 50 characters
# - the new gargle functions can accept a key max 32 characters
# - if you have an old "BOXR_PASSWORD", truncate it to use the first 32 chars

if (nchar(Sys.getenv(env_secret)) > 32) {
if (gargle::secret_has_key("BOXR_PASSWORD")) {
# TODO: replace with cli::cli_alert_warning()
warning(
paste(
"You may be using an older `BOXR_PASSWORD`.",
"Truncate to use the first 32 characters."
"You are using an obselete credential `BOXR_PASSWORD`.",
"Truncate to use the first 32 characters, and rename as `BOXR_KEY`."
)
)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_01_oauth.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ context("OAuth2.0 via JWT")
# they are not relevant to boxr beyond that

# path_secret <- system.file("secret", "boxr-testing.json", package = "boxr")
# env_secret <- "BOXR_PASSWORD"
# env_secret <- "BOXR_KEY"
#
# test_that("gargle can find secret", {
# expect_true(gargle::secret_has_key(env_secret))
Expand Down

0 comments on commit 4d4c23e

Please sign in to comment.