render: turn on every caddy_* flag so CI validates all plugin directives
Build custom Caddy / build (push) Successful in 1m31s
Build custom Caddy / build (push) Successful in 1m31s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f9c44868a4
commit
cc85a959d1
1 file changed
+7
-2
@@ -1,6 +1,8 @@
|
||||
"""Render phil/ansible's Caddyfile.j2 for `caddy validate`.
|
||||
|
||||
Usage: render_caddyfile.py <ansible checkout> (prints the Caddyfile)
|
||||
Usage: render_caddyfile.py <ansible checkout> [stock] (prints the Caddyfile)
|
||||
By default every caddy_* feature flag is turned on, so CI validates all
|
||||
plugin directives; "stock" renders with the flags as committed.
|
||||
Only non-secret group_vars are loaded. Values that reference other variables
|
||||
are resolved by rendering until nothing changes; values that need the vault
|
||||
stay unresolved, and StrictUndefined makes the Caddyfile fail loudly if it
|
||||
@@ -13,7 +15,10 @@ root = pathlib.Path(sys.argv[1])
|
||||
ctx = {}
|
||||
for f in ("domains.yml", "infrastructure.yml"):
|
||||
ctx.update(yaml.safe_load((root / "group_vars/all" / f).read_text()) or {})
|
||||
ctx["caddy_custom"] = True
|
||||
if sys.argv[2:] != ["stock"]:
|
||||
for k, v in list(ctx.items()):
|
||||
if k.startswith("caddy_") and isinstance(v, bool):
|
||||
ctx[k] = True
|
||||
|
||||
env = jinja2.Environment(undefined=jinja2.StrictUndefined, keep_trailing_newline=True)
|
||||
|
||||
|
||||
Reference in new issue
Block a user