Expiration Warnings

Expiration warnings help you track time-limited environment variables such as temporary API keys, tokens, or credentials. By annotating variables with an expiration date, dotenv-diff can warn you before credentials expire — or fail your pipeline when they already have.

Syntax

Add an @expire comment directly above the environment variable you want to track.

.env
# @expire 2025-12-31 (@ is optional)
TEMP_API_TOKEN=abc123

Strict Mode Integration

When running in --strict mode, expiration warnings are treated as errors.

Expired or soon-expiring variables cause the process to fail.

CLI
dotenv-diff --strict

Configuration

Expiration warnings are enabled by default. You can disable them using a CLI flag or the configuration file.

CLI
dotenv-diff --no-expire-warnings
Or in dotenv-diff.config.json:
dotenv-diff.config.json
{
  "expireWarnings": false
}

Why Use Expiration Warnings

  • Prevent production failures caused by expired credentials.
  • Encourage regular API key and token rotation.
  • Document credential lifetimes directly in your environment files.
  • Improve security hygiene in CI/CD pipelines.

Best Practices

  • Always use the YYYY-MM-DD date format.
  • Add comments explaining why a variable has an expiration date.