diff --git a/test/render_caddyfile.py b/test/render_caddyfile.py index 57b1660..610bfc3 100644 --- a/test/render_caddyfile.py +++ b/test/render_caddyfile.py @@ -1,6 +1,8 @@ """Render phil/ansible's Caddyfile.j2 for `caddy validate`. -Usage: render_caddyfile.py (prints the Caddyfile) +Usage: render_caddyfile.py [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)