provisioning-catalog/components/stalwart/cluster/vars.nu

20 lines
829 B
Text
Raw Permalink Normal View History

#!/usr/bin/env nu
# Derived variables for stalwart bundle rendering.
# Receives component record as JSON argument, outputs extra vars as JSON.
# Keys are lowercase to match NCL field convention — merged into the stalwart tera context.
def main [component_json: string]: nothing -> nothing {
let s = ($component_json | from json)
let relay_tls = ($s | get -o relay | default {} | get -o tls | default true)
{
relay_tls_value: (if $relay_tls { "require" } else { "opportunistic" }),
relay_name: ($s | get -o relay | default {} | get -o name | default "ses"),
tls_cert_path: "/etc/stalwart/tls/tls.crt",
tls_key_path: "/etc/stalwart/tls/tls.key",
tls_mount_path: "/etc/stalwart/tls",
config_mount: "/etc/stalwart",
}
| to json --raw
| print
}