fidelius
fidelius copied to clipboard
Use environmental variables in password
Is it possible to use '
r Sys.getenv("CANVASPASS")'
or "
r as.character(read.table('H:/Mi unidad/Curso_UDP/pass_canvas.txt', quote='"', comment.char=''))"' ` in password YAML?
output:
fidelius::html_password_protected:
style:
button_text: "Ingresar clave"
password: 'r Sys.getenv("CANVASPASS")
'
preview: false
hint: ""
bundle: true
output_format:
rmarkdown::html_document:
toc: true # table of content true
toc_depth: 5 # upto three depths of headings (specified by #, ## and ###)
toc_float: true
Hi @AGSCL,
I think this should be possible with something like:
---
output:
fidelius::html_password_protected:
password: `r Sys.getenv('CANVASPASS')`
output_format: rmarkdown::html_document
---
Let me know if this does not work for you.
Hi,
I get the following error
Error in yaml::yaml.load(..., eval.expr = TRUE) :
Scanner error: while scanning for the next token at line 3, column 15 found character that cannot start any token at line 3, column 15
|
<br class="Apple-interchange-newline"><!--EndFragment-->
</body>
</html>
If I replace it with "`r Sys.getenv('Key1')`", it looks that it don't evaluate the code, so If I put the following password, it work: `r Sys.getenv('Key1')`
I was encountering the same error in yaml::yaml.load(..., eva.expr = TRUE)
. I found the !expr
tag as described in yaml::yaml.load()
to work. For example:
output:
fidelius::html_password_protected:
password: !expr as.character(1+1)