Closed jonthegeek closed 1 year ago
I could PR this if you agree, but I'm not sure about testing nor whether there's already a pattern for this sort of thing in knitr.
Yes you can PR. We don't currently test it as part of the package - it is tested in knitr-examples
I don't think it needs further test just replacing the default key in the function with key = Sys.getenv("R_KNITR_IMGUR_KEY", <current default>)
.
Though I don't know if an option or an environment variable is preferred. @yihui do you have a preference ?
We should probably follow the pattern of xfun::tinify()
which would lead to
getOption("knitr.imgur.key", Sys.getenv("R_KNITR_IMGUR_KEY", <current default value for arg >))
Environment variables are slightly more GHA-friendly, and I imagine that's a case where this would be used, so option > env > default makes sense to me!
I'll PR this in a sec...
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
Suggestion for improvement:
?knitr::imgur_upload
saysThis would be much more feasible if
imgur_upload()
consulted an environment variable (and/or option) for the key.Right now, when
imgur_upload()
is used insidereprex::reprex()
, there's no way to pass a key.I could PR this if you agree, but I'm not sure about testing nor whether there's already a pattern for this sort of thing in knitr.