import { writeFile } from "node:fs/promises"; import { resolve } from "node:path"; import { root } from "./runtime"; for (const role of ["api", "worker"]) { const value = `pid_file = "/tmp/bao-agent.pid" log_level = "error" vault { address = "https://openbao:8200" ca_cert = "/pki/ca.crt" } auto_auth { method "cert" { mount_path = "auth/cert" config = { name = "${role}" ca_cert = "/pki/ca.crt" client_cert = "/pki/cert.pem" client_key = "/pki/key.pem" reload = true } } } template_config { static_secret_render_interval = "5s" exit_on_retry_failure = false } ${[ ["database_url", "database_url"], ["cache_url", "cache_url"], ["s3.json", "s3_json"], ...(role === "worker" ? [["publisher_url", "publisher_url"]] : []), ["freshness", "timestamp"], ] .map( ([file, key]) => `template { destination = "/run/app/${file}" perms = "0600" backup = false error_on_missing_key = true contents = <