Skip to main content

dotguard logo

dotguard

Validate your .env file against .env.example before you deploy.

PyPI Python MIT License


The problem

AI-assisted coding is fast. It's also quietly shipping placeholder credentials, empty secrets, and misconfigured environments to production every day.

Your .env file is the last line of defense — and most teams never validate it.

dotguard does.


What it catches

Check Severity
Key in .env.example missing from .env ERROR
Sensitive key with an empty value ERROR
Sensitive key with a placeholder value (e.g. your-key-here) ERROR
.env file tracked or staged in git ERROR
Non-sensitive key with a placeholder value WARNING
Key in .env not documented in .env.example WARNING
Non-sensitive key with an empty value WARNING

Install

pip install dotguard

Usage

dotguard                   # Validate .env against .env.example
dotguard --strict          # Treat warnings as errors (recommended for CI)
dotguard --fail-on errors  # Exit 1 on errors only (default)
dotguard --fail-on warnings # Exit 1 on warnings only
dotguard --fail-on all     # Exit 1 on any issue
dotguard --no-extras       # Treat undocumented keys as errors
dotguard --no-git-check    # Skip git tracking check
dotguard --quiet           # Silent — exit code only
dotguard init              # Generate .env.example from your .env
dotguard init --force      # Overwrite an existing .env.example

Exit codes

Code Meaning
0 All checks passed
1 One or more errors
2 File not found

CI integration

Drop dotguard into your pipeline to catch environment issues before they reach production.

GitHub Actions (reusable workflow)

The easiest way to integrate dotGuard is via the reusable workflow. Add this to your own repo's workflow file:

jobs:
  dotguard:
    uses: Vengeance-us/dotguard/.github/workflows/dotguard.yml@main
    with:
      fail_on: "errors"       # "errors" | "warnings" | "all" (default: "errors")
      env_file: ".env"        # path to your .env file (default: ".env")
      example_file: ".env.example"  # path to your .env.example (default: ".env.example")
      pr_comment: true        # post findings as a PR comment (default: false)

If no .env file is found in the repository, dotGuard skips gracefully and the workflow passes.

GitHub Actions (inline)

Prefer to inline it directly in your own workflow?

- name: Validate environment
  run: |
    pip install dotguard
    dotguard --fail-on errors

Pre-commit hook

# .git/hooks/pre-commit
dotguard --quiet || { echo "dotguard: fix .env errors before committing"; exit 1; }

Getting started

If you don't have a .env.example yet, generate one from your existing .env:

dotguard init

This creates a .env.example with all your keys present but values scrubbed — safe to commit, ready to share with your team.

Then validate any time:

dotguard

License

MIT


Built for developers who ship with confidence.

Metadata

Release files for dotguard 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dotguard 0.5.0
File Size Uploaded Provenance Actions
dotguard-0.5.0.tar.gz 10.7 kB With provenance Details for dotguard-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dotguard 0.5.0
File Interpreter ABI Platform Actions
dotguard-0.5.0-py3-none-any.whl Python 3 none any Details for dotguard-0.5.0-py3-none-any.whl

Total release size: 20.3 kB

Release files / dotguard-0.5.0.tar.gz

Download URL dotguard-0.5.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b1d48537b6a428a526e8a12d1163b16abe1c8fbaed1ad06fdc66a9df3e850ba9
BLAKE2b-256 checksum
How to use checksums
624857cd6b0b02c112faff03afa974ff15750095a8d204ccc12c2d331db00feb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

Release files / dotguard-0.5.0-py3-none-any.whl

Download URL dotguard-0.5.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae22f96f7e15309a430d9fde90ab261880242e854311d322d395f27350dfbc86
BLAKE2b-256 checksum
How to use checksums
3ff776ce839abc2d0d98f44d306efe0bcb2cce671db4c105c5074f0421184418
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

Security for dotguard 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dotguard-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page