configdoctor scans a repository for configuration drift before CI, deploys, and runtime failures.
Current MVP scope:
- compare env var usage in code against
.env.example - compare
docker-composeenv references against.envand.env.example - compare GitHub Actions env and secret references against
.env.example - compare ports detected from env files,
Dockerfile,docker-compose, and Kubernetes manifests - emit pretty terminal output, JSON, or SARIF
Scanned inputs:
.env.env.exampleDockerfiledocker-compose.yml/compose.yml.github/workflows/*.yml- Kubernetes YAML manifests
- source code env usage in JavaScript, TypeScript, Python, Go, and shell scripts
Configuration drift is easy to miss:
- code starts using a new env var but
.env.examplestays stale - GitHub Actions references a secret nobody documented
- compose ports differ from container ports and manifests
- Dockerfile exposes the wrong port after a refactor
configdoctor catches those mismatches early.
go install github.com/CodeWithAmeer/configdoctor@latestmake build
./bin/configdoctor versionconfigdoctor init
configdoctor scan
configdoctor scan --format json .
configdoctor scan --format sarif --quiet .Scan a repository. The path defaults to the current directory.
Flags:
--format pretty|json|sarif--config PATH--fail-on info|warning|error--quiet--no-color
Path is positional only in this MVP.
Create a starter .configdoctor.yml in the current directory.
Flags:
--dir PATH
Print build version metadata.
configdoctor --help
configdoctor scan --helpCreate .configdoctor.yml:
exclude_paths:
- .git
- node_modules
- vendor
- dist
- build
- coverage
disabled_rules:
- EXAMPLE_ENV_UNUSED
env_files:
- .env
- .env.example
- .env.local
fail_threshold: errorexclude_paths: extra directories or paths to skipdisabled_rules: rule IDs to disableenv_files: env-style files to scanfail_threshold:info,warning, orerror
CODE_ENV_MISSING_EXAMPLEEXAMPLE_ENV_UNUSEDCOMPOSE_ENV_UNDOCUMENTEDGITHUB_ACTIONS_ENV_UNDOCUMENTEDDOCKERFILE_EXPOSE_PORT_MISMATCHCOMPOSE_PORT_MISMATCHK8S_CONTAINER_PORT_MISMATCHMISSING_ENV_EXAMPLE
configdoctor scans these patterns conservatively:
process.env.NAMEprocess.env["NAME"]process.env['NAME']
os.getenv("NAME")os.environ["NAME"]os.environ.get("NAME")
os.Getenv("NAME")os.LookupEnv("NAME")
${NAME}$NAME
Use an exact release tag when referencing the published action.
name: configdoctor
on:
pull_request:
push:
branches: [main]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: CodeWithAmeer/configdoctor@v1.0.0
with:
path: .
format: pretty
fail-on: errorpath: repository path to scanformat:pretty,json, orsarifconfig: optional path to.configdoctor.ymlfail-on: failure threshold overridequiet:trueorfalseno-color:trueorfalse
configdoctor found 3 issue(s)
[ERROR] CODE_ENV_MISSING_EXAMPLE
src/index.js:2
environment variable "JWT_SECRET" is used in code but missing from .env.example
[WARNING] GITHUB_ACTIONS_ENV_UNDOCUMENTED
.github/workflows/ci.yml:8
GitHub Actions reference "DEPLOY_TOKEN" is not documented in .env.example
[WARNING] DOCKERFILE_EXPOSE_PORT_MISMATCH
Dockerfile:4
Dockerfile exposes port 7000, but detected ports are 3000, 8080
Summary: 1 error(s), 2 warning(s), 0 info
pretty: human-readable terminal outputjson: machine-readable structured outputsarif: SARIF 2.1.0 for code scanning platforms
make test
make buildSee examples/demo for a small sample repository.
MIT