2. When not inputting the userid correctly (happened to me that I was running several lines of code quickly after each other, and the next line was taken as input), is there a way to make the prompt for userid and pwd reappear? Or is it maybe also possible to store userid and pwd somewhere? (.Renviron does not work, which was expected).
{rgbif} stores user credentials in .Renviron, however, making changes automatically to this file could cause unexpected results for users. It is making a change outside of the environment of the package, same with Sys.setenv() really. I'm thinking about this section in the R Packages book 2nd edition: https://r-pkgs.org/code.html#sec-code-r-landscape
Storing information here is simple enough: usethis::edit_r_environ(), but is this a better solution than Sys.setenv() on the long term?
The working of usethis::edit_r_environ() isn't too complex internally:
function (scope = c("user", "project"))
{
path <- scoped_path_r(scope, ".Renviron", envvar = "R_ENVIRON_USER")
edit_file(path)
ui_bullets(c(`_` = "Restart R for changes to take effect."))
invisible(path)
}
Originally posted by @lottepohl in https://github.com/inbo/etn/issues/318#issuecomment-2447216295
{rgbif}
stores user credentials in.Renviron
, however, making changes automatically to this file could cause unexpected results for users. It is making a change outside of the environment of the package, same withSys.setenv()
really. I'm thinking about this section in the R Packages book 2nd edition: https://r-pkgs.org/code.html#sec-code-r-landscapeStoring information here is simple enough:
usethis::edit_r_environ()
, but is this a better solution thanSys.setenv()
on the long term?{keyring}
is used by{move2}
: https://gitlab.com/bartk/move2/-/blob/main/R/movebank_credentials.R and is something I had in mind on the long runThe working of
usethis::edit_r_environ()
isn't too complex internally:With helper:
And cascades into more and more helpers... But it could be done