Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use modern gargle secret management #572

Merged
merged 8 commits into from
Nov 10, 2023
Merged

Use modern gargle secret management #572

merged 8 commits into from
Nov 10, 2023

Conversation

hadley
Copy link
Member

@hadley hadley commented Nov 7, 2023

@jennybc I don't think this code is in quite the right place, because ideally I want it to auth automatically for R CMD check and pkgdown. Can you suggest where I should move this code?

@hadley hadley requested a review from jennybc November 7, 2023 22:55
@jennybc
Copy link
Collaborator

jennybc commented Nov 9, 2023

The approach I've settled on in googlesheets4 and googledrive is to have an internal function (e.g. drive_auth_internal()) that auths with a specific service account. (For both of those packages there are two relevant service accounts: one that I use for testing, one that I use for docs (including pkgdown). You don't seem to have that wrinkle here.)

https://github.com/tidyverse/googledrive/blob/74a69a3a1fd66e930802ce6e461538c9e15f7c86/R/drive_auth.R#L285-L347

I then call that function in various places. Most importantly, in tests/testthat/helper.R:

https://github.com/tidyverse/googledrive/blob/74a69a3a1fd66e930802ce6e461538c9e15f7c86/tests/testthat/helper.R#L1-L10

I also call it in, e.g., vignette setup chunks:

https://github.com/tidyverse/googledrive/blob/74a69a3a1fd66e930802ce6e461538c9e15f7c86/vignettes/articles/permissions.Rmd#L6-L9

And, importantly, call it in .onLoad(), if we seem to be building the pkgdown website:

https://github.com/tidyverse/googledrive/blob/74a69a3a1fd66e930802ce6e461538c9e15f7c86/R/zzz.R#L11-L16

@hadley
Copy link
Member Author

hadley commented Nov 10, 2023

Based on run time (60s vs ~16s on main), I'm pretty confident that this is now enabled for pkgdown too.

@hadley hadley merged commit 19724c3 into main Nov 10, 2023
13 checks passed
@hadley hadley deleted the gargle-secrets-update branch November 10, 2023 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants