Closed jeanetteclark closed 3 years ago
Does the .Renviron solve this completely?
Its best not to depend on specific .Renviron setups. Instead, use the options
facility to retrieve credentials from the users environment like we do for the dataone
package.
`
Hm. So are you thinking that a user can set the API token either via options(scopus_key = ...)
or a user can add that line to their .Rprofile
? The SCOPUS query function would then do something like SCOPUSKEY <- getOption("scopus_key")
to retrieve it.
I do want to find a way to make it easy to not have to set it every time. Unlike dataone
the keys don't expire, and they are somewhat difficult to track down on the SCOPUS website (at least compared to the Arctic Data Center), so retrieving one for every R session sounds annoying. That is why I was thinking of the .Renviron approach and setting it as an environment variable as opposed to an option.
Also: https://twitter.com/jennybryan/status/668908727852896256
Summary of slack discussion:
keyring
seems like a good way to store keys in either encrypted files or in the operating system's credential storeI got a keyring helper function set up scythe_set_key()
as a wrapper around the keyring functions.
Disadvantages so far are:
keyring
to fix a bug so we have a workaroundTo dos:
I can rewrite the readme
For testing on Travis and related platforms, they have a facility for including encrypted keys to be used as secrets. See: https://docs.travis-ci.com/user/encryption-keys/ and https://cran.r-project.org/web/packages/httr/vignettes/secrets.html#travis Of course, Travis itself has access to those keys, so I wouldn't be pushing the nuclear football codes up there.
I switched to github actions, and have set up the two API keys as secrets in the repo. They are passed via environmental variables to the functions that need them by the config file. It is a bit of a backdoor route to the auth when we would prefer users to use keyring, but we can choose whether we document that or not
R CMD check is passing!
Two steps here:
Not sure if we should load the keys through a helper function or set the package up to load the file automatically