set_config_value
Set a Caddy config subtree (e.g., upstreams) with immediate effect, built-in undo/rollback, and dry-run preview. Refuses admin API edits to keep the connection alive.
Instructions
[WRITE][risk=medium] Set a caddy config subtree (e.g. a route's upstreams); reversible — the prior subtree is fetched first and the undo restores it.
Caddy applies the change immediately. On traefik/haproxy this raises the support matrix's teaching error. Pass dry_run=True to preview.
Refuses the 'admin' subtree: that configures the admin API this tool speaks to, so disabling or moving it would end the connection the undo needs. Change the admin block in caddy's own config file and reload locally. The refusal applies under dry_run too — a preview whose real call would be refused must report that, not a green 'wouldSet'.
Args: path: Slash-separated config path (from search_config / list_routes, e.g. apps/http/servers/srv0/routes/0/handle/0/upstreams). value: The JSON value to write at that path. insert: Insert into an array at that index instead of replacing. This is what re-creating a deleted array element requires — Caddy rejects a create at an index past the (now shorter) array. dry_run: If True, preview without changing. target: Proxy target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| value | Yes | ||
| insert | No | ||
| target | No | ||
| dry_run | No |