Skip to content

Configuration

EnvGuard can read default options from a .envguardrc.yaml file in your project root. This lets you run envguard validate without repeating flags.

Config File Location

EnvGuard searches for .envguardrc.yaml in the current working directory. You can also use .envguardrc.yml or .envguardrc.json.

Generate a Config File

bash
envguard init --config

This creates .envguardrc.yaml with sensible defaults:

yaml
schema: envguard.yaml
env:
  - .env
format: text
strict: false

Config Options

OptionTypeDefaultDescription
schemastringenvguard.yamlPath to schema file
envstring[][".env"]Environment files to validate
formatstringtextOutput format: text, json, github, sarif
strictbooleanfalseFail if .env contains undefined keys
envNamestring""Environment name for requiredIn/devOnly
scanSecretsbooleanfalseScan for hardcoded secrets
watchbooleanfalseEnable watch mode

Example

yaml
schema: config/envguard.yaml
env:
  - .env
  - .env.local
  - .env.production
format: sarif
strict: true
envName: production
scanSecrets: true

Environment Variable Overrides

Any config option can be overridden with an environment variable:

bash
ENVGUARD_SCHEMA=other.yaml
ENVGUARD_FORMAT=json
ENVGUARD_STRICT=true
ENVGUARD_SCAN_SECRETS=true
ENVGUARD_ENV_NAME=staging

Monorepo Config

For monorepos, you can define multiple packages in the config:

yaml
packages:
  - apps/web
  - apps/api
  - packages/shared

EnvGuard will look for envguard.yaml and .env in each package directory.

Released under the MIT License.