Flatten any format
# app.yaml
db:
host: db.internal
pool:
max: 20
flattens to
db.host "db.internal" db.pool.max 20
confdrift compares your environment configs and tells you what drifted, before the deploy does.
go install github.com/eduardofrafre/confdrift@latest$ confdrift staging/configmap.yaml production/configmap.yaml DATABASE_URL changed staging "postgres://checkout:<redacted>@db.staging.example.com:5432/checkout" production "postgres://checkout:<redacted>@db.prod.example.com:5432/checkout" FEATURE_NEW_CART missing from production staging "true" production (not set) LOG_LEVEL changed staging "debug" production "info" PAYMENTS_TIMEOUT_MS changed staging "3000" production "300" STRIPE_API_KEY changed staging <redacted> production <redacted> 5 of 6 keys drifted across 2 files (1 missing, 4 changed). $ echo $? 1
The problem
How it works
# app.yaml
db:
host: db.internal
pool:
max: 20
flattens to
db.host "db.internal" db.pool.max 20
| key | stg | prod | |
|---|---|---|---|
| RETRY_LIMIT | "5" | "5" | same |
| TIMEOUT_MS | "3000" | "300" | changed |
| NEW_CART | "true" | - | missing |
Try it
The real engine, compiled to WebAssembly. Nothing you type leaves this page.
Using it
# two environments confdrift .env.staging .env.production # or any number of them confdrift dev.yaml staging.yaml prod.yaml # only keys missing somewhere confdrift a.env b.env --keys-only # skip keys expected to differ confdrift a.env b.env --ignore 'DATABASE_*' # for scripts and bots confdrift a.env b.env --format json
# .github/workflows/config-drift.yml
on: pull_request
jobs:
drift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
- run: go run github.com/eduardofrafre/confdrift@latest --keys-only deploy/staging.env deploy/production.env
.env, .env.production, prod.env. Quotes, export, comments and multi-line values are understood. ${VARS} are not expanded: if the reference changed, that is drift.db.pool.max or servers[0], so a YAML file can be compared with a JSON one.data keys. Output of helm template or kustomize build works as is: other resources are skipped.Values of keys that look like credentials (*PASSWORD*, *TOKEN*, *SECRET*, *API_KEY* and similar) print as <redacted>, and so do passwords inside URLs. They are still compared, so a rotated secret still shows up as drift. --show-secrets prints them.
| exit | meaning |
|---|---|
| 0 | The files agree |
| 1 | Drift found |
| 2 | Bad input: unreadable file, parse error, unknown flag |
Install
x86-64 shown; for ARM replace amd64 with arm64.
curl -sL https://github.com/eduardofrafre/confdrift/releases/download/v0.1.0/confdrift_0.1.0_linux_amd64.tar.gz | tar xz sudo mv confdrift_0.1.0_linux_amd64/confdrift /usr/local/bin/ confdrift --version
Apple silicon shown; on an Intel Mac replace arm64 with amd64.
curl -sL https://github.com/eduardofrafre/confdrift/releases/download/v0.1.0/confdrift_0.1.0_darwin_arm64.tar.gz | tar xz sudo mv confdrift_0.1.0_darwin_arm64/confdrift /usr/local/bin/ confdrift --version
Download confdrift_0.1.0_windows_amd64.zip (or the arm64 build), unzip it, and put confdrift.exe on your PATH. Then, in PowerShell:
confdrift .env.staging .env.production
With Go 1.24 or newer:
go install github.com/eduardofrafre/confdrift@latest
Every build, with checksums, is on the releases page.
Open source
Found drift it missed, or a format it should read? Open an issue.