Config Git History#

Added in v0.5. Every mutation the dashboard makes to config.yaml (profile hot-swap, drop-action change, whitelist / blocklist edit, domain add/remove, pipeline tuning) is now auto-committed to a local git repo. Recovery from a bad edit becomes infraguard config revert instead of “hope you kept the .bak”.

Where#

Default: ~/.config/infraguard/history.git (override with the INFRAGUARD_CONFIG_HISTORY env var).

The .bak sidecar next to config.yaml still gets written for one-step undo; the git repo is the multi-step story.

Inspect#

# List the last 20 changes with commit sha, timestamp, and summary.
infraguard config log

# Show a specific commit as a diff.
git -C ~/.config/infraguard/history.git show HEAD~2

# Revert to the state N commits ago.
infraguard config revert HEAD~2

Wiring#

infraguard.config.git_history.ConfigHistory is called from _save_raw in infraguard/config/cli_ext.py, which is the shared “write config.yaml back to disk” helper every dashboard mutation route eventually calls. Failures are best-effort - a broken git repo never blocks a config save.

Commit metadata#

Each commit message carries Actor: and Timestamp: trailers. Actor is the operator identity extracted from the mutation request (bearer token prefix, session id, or cli for local edits).

$ git -C ~/.config/infraguard/history.git log -1 --pretty=full
commit 3a1c...
    swap profile: cdn.example.com -> jquery-4.0

    Actor: session:1a2b3c4d...
    Timestamp: 1730073600