Documentation
¶
Overview ¶
Package cli implements cadish's command-line subcommands.
Index ¶
- func Adapt(args []string) int
- func Check(args []string) int
- func Edge(args []string) int
- func EdgeBuild(args []string) int
- func EdgeDeploy(args []string) int
- func EdgeManageRoutes(args []string, action string) int
- func Fmt(args []string) int
- func Gateway(args []string) int
- func Ingress(args []string) int
- func Logs(args []string) int
- func Reload(args []string) int
- func Run(args []string) int
- func Usage(w io.Writer)
- func Version() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Adapt ¶
Adapt converts a Varnish VCL file into a best-effort Cadishfile skeleton. It writes the Cadishfile to stdout (or -o FILE) and a mapped-vs-review summary to stderr. It is intentionally lenient: the output is a starting point a human finishes, not a runnable config — every uncertain construct becomes a `# TODO(adapt): …` comment.
func Edge ¶
Edge dispatches the `cadish edge …` subcommands. It is the management plane for Cadish Edge; this first slice ships only `build` (IR + coverage report).
func EdgeBuild ¶
EdgeBuild compiles a Cadishfile, projects each site to an EdgeIR, writes the IR JSON, and prints a coverage report. With -strict it exits non-zero when anything is delegated (the edge equivalent of `cadish check -strict`).
func EdgeDeploy ¶
EdgeDeploy builds each site's worker bundle and uploads it (script + bindings, no routes) to Cloudflare. Auth: CF_API_TOKEN; origin: -origin or CADISH_EDGE_ORIGIN. -allow-public-values acknowledges that the VALUE-EXPOSURE warnings have been reviewed and none of the listed literals is a secret; the ForcedPass correctness gate is not bypassed by this flag.
func EdgeManageRoutes ¶
EdgeManageRoutes attaches (enable) or detaches (disable) the worker routes.
func Fmt ¶
Fmt formats Cadishfiles. With -w it rewrites each file in place; otherwise it prints the formatted result to stdout. With no file arguments it reads from stdin and writes to stdout (-w is ignored for stdin). On a parse error it prints a "file:line:col: message" diagnostic to stderr and returns a non-zero exit code; other files are still processed.
func Gateway ¶
Gateway runs cadish in-cluster as a Kubernetes Gateway API controller: it serves traffic from routing translated out of GatewayClass / Gateway / HTTPRoute objects (the cluster is the source of truth), while the base Cadishfile supplies only globals (admin/ACME/ access-log). It watches those resources and hot-swaps the live routing through Server.ApplyConfig — the SAME atomic swap `cadish ingress` uses. It runs as a SEPARATE process from `cadish ingress` (a separate Deployment / GatewayClass controllerName), so the two controllers do not contend for the same objects. Serves until SIGINT/SIGTERM; SIGHUP re-reads the base Cadishfile and re-reconciles.
Scope (slices 1+2): GatewayClass acceptance; Gateway HTTP + HTTPS (TLS Terminate) listeners with certificateRefs (BYO Secret termination, the SAME Server.SetDynamicCerts path the Ingress controller uses); HTTPRoute host + path (Exact / PathPrefix) routing with advanced matchers (headers / queryParams / method); cross-namespace refs gated by a ReferenceGrant; weighted multi-backend pools; and status conditions. See docs/gateway-api.md.
func Ingress ¶
Ingress runs cadish in-cluster as an Ingress controller: it serves traffic from routing translated out of Kubernetes Ingress objects (the cluster is the source of truth), while the base Cadishfile supplies only globals (admin/ACME/access-log). It watches Ingress/IngressClass/Secret/ConfigMap and hot-swaps the live routing through Server.ApplyConfig. Serves until SIGINT/SIGTERM; SIGHUP re-reads the base Cadishfile and re-reconciles.
func Logs ¶
Logs implements `cadish logs` — the NCSA-style access-log tail.
Source (D44): by default `cadish logs` dials the running server's access-log unix socket (`-log-socket`, default ${TMPDIR}/cadish-access.sock) and streams the LIVE access log — the server keeps it in memory and fans it out only while a consumer is attached (no disk writes). It renders each request line with host/path/status/ cache filters in a text|ncsa|json format. Redirect/pipe to persist: `cadish logs > access.log`.
A FILE argument (or stdin) reads a previously-saved NDJSON log instead of the socket; `-f` then follows the file (tail -f) until interrupted. See docs/logs.md.
Usage:
cadish logs [-format text|ncsa|json] [filters] # live (socket) cadish logs > access.log # persist live stream cadish logs [-f] [-format …] [filters] FILE # saved-file tail cat access.json | cadish logs -format ncsa # piped/stdin
Filters: -host SUB, -path SUB (case-insensitive substring), -cache TOKEN (HIT/MISS/…), -status CODE (exact), -status-class N (1..5 for Nxx), -min-status CODE (>=).
func Reload ¶
Reload signals a running `cadish run` process to hot-reload its Cadishfile (SIGHUP). It locates the process either by -pidfile FILE (the path passed to `cadish run -pidfile`) or by an explicit -pid N. The reload is zero-downtime and fail-safe in the server: a bad new config is rejected there and the old one keeps serving; this command only delivers the signal.
Flags: -pidfile PATH (read the PID from this file) or -pid N (signal this PID). Exit code: 0 on a delivered signal, non-zero on a missing pidfile / bad PID / signal error.
func Run ¶
Run loads the Cadishfile, builds the caching reverse proxy, listens on the configured address (plain HTTP this milestone), and serves until SIGINT/SIGTERM, at which point it drains in-flight requests gracefully.
Flags: -config PATH (the Cadishfile), -addr ADDR (listen address, default ":80").
Types ¶
This section is empty.