2017-09-19 00:35:37 -07:00
|
|
|
require "lib/core.nom"
|
|
|
|
|
2017-10-02 17:21:22 -07:00
|
|
|
compile [with secrets %block] to code: ".."
|
2017-12-14 13:57:53 -08:00
|
|
|
do
|
|
|
|
local secrets = {};
|
|
|
|
\(%block as lua statements)
|
|
|
|
end
|
2017-09-19 00:29:31 -07:00
|
|
|
|
2017-09-20 03:06:15 -07:00
|
|
|
# Access the lua variable that should be within scope
|
2017-10-02 17:21:22 -07:00
|
|
|
compile [secrets] to: "secrets"
|
2017-09-28 17:49:15 -07:00
|
|
|
|
2017-10-02 19:00:58 -07:00
|
|
|
compile [secret %key, secret value of %key, secret value for %key] to:
|
2017-09-28 17:49:15 -07:00
|
|
|
assert ((%key's "type") == "Var") ".."
|
|
|
|
|Wrong type, expected Var, but got: \(%key's "type")
|
|
|
|
"secrets[\(repr (%key's "value"))]"
|
|
|
|
|
2017-10-02 17:21:22 -07:00
|
|
|
compile [secret %key = %new_value] to code:
|
2017-09-28 17:49:15 -07:00
|
|
|
assert ((%key's "type") == "Var") ".."
|
|
|
|
|Wrong type, expected Var, but got: \(%key's "type")
|
2017-10-02 19:00:58 -07:00
|
|
|
"secrets[\(repr (%key's "value"))] = \(%new_value as lua);"
|
2017-09-19 00:29:31 -07:00
|
|
|
|
2017-10-02 17:21:22 -07:00
|
|
|
rule [rules about secrecy] =: ["with secrets %"]
|
2017-10-02 19:00:58 -07:00
|
|
|
|