You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
535 B
Plaintext

def before_apply_all [ctx] {
let silo_ctx = (silo context | from json)
let config_file = ($silo_ctx.dirs.config | path join "silo.toml")
mut config = open_config $config_file
$config.template_context = ($config.template_context | default {} | merge (template_context $ctx $silo_ctx $config))
$config | save -f $config_file
}
def open_config [path: string] {
if ($path | path exists) {
open $path
} else {
{}
}
}
def template_context [ctx: any, silo_ctx: any, config: any] {
{
username: (whoami)
}
}