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) } }