envcheck supports multiple configuration methods to fit your workflow.
envcheck automatically loads configuration from these files (in order of precedence):
.envcheckrc.envcheckrc.jsonenvcheck.config.json.envcheckrc.jsenvcheck.config.js
{
"path": ".",
"envFile": ".env.example",
"format": "text",
"failOn": "none",
"ignore": [
"node_modules/**",
"dist/**",
"**/*.test.js"
],
"noColor": false,
"quiet": false,
"watch": false,
"suggestions": true,
"progress": true
}// envcheck.config.js
export default {
path: '.',
envFile: '.env.example',
format: 'text',
failOn: 'missing',
ignore: [
'node_modules/**',
'dist/**',
],
// Dynamic configuration
suggestions: process.env.CI !== 'true',
progress: process.stdout.isTTY,
};path(string): Directory or file to scan (default:".")envFile(string): Path to .env.example file (default:".env.example")format(string): Output format -text,json,github(default:"text")failOn(string): Exit with code 1 if condition met -missing,unused,undocumented,all,none(default:"none")
ignore(array): Glob patterns to ignore{ "ignore": [ "node_modules/**", "dist/**", "**/*.test.js", "**/*.spec.ts" ] }
noColor(boolean): Disable colored output (default:false)quiet(boolean): Suppress output when no issues found (default:false)suggestions(boolean): Show intelligent suggestions (default:true)progress(boolean): Show progress indicators (default:true)
watch(boolean): Watch mode - rerun on file changes (default:false)fix(boolean): Auto-fix issues by updating .env.example (default:false)config(string): Load configuration from specific file
CLI arguments always override configuration file settings:
# Config file sets format: "text"
# This command uses format: "json"
envcheck . --format jsonCreate different configs for different environments:
# Development
envcheck --config .envcheckrc.dev.json
# Production
envcheck --config .envcheckrc.prod.json
# CI/CD
envcheck --config .envcheckrc.ci.json- name: Check environment variables
run: envcheck . --format github --fail-on allenvcheck:
script:
- envcheck . --format text --fail-on missingstage('Env Check') {
steps {
sh 'envcheck . --format json --fail-on all'
}
}- Commit your config: Add
.envcheckrc.jsonto version control - Use ignore patterns: Exclude test files and build artifacts
- Set failOn in CI: Use
--fail-on allin CI/CD pipelines - Enable suggestions: Keep
suggestions: truefor helpful hints - Use watch mode: Enable
--watchduring development
{
"format": "github",
"failOn": "all",
"quiet": false,
"suggestions": false,
"progress": false
}{
"format": "text",
"failOn": "none",
"watch": true,
"suggestions": true,
"progress": true
}{
"path": ".",
"ignore": [
"node_modules/**",
"packages/*/dist/**",
"packages/*/build/**"
],
"envFile": ".env.example"
}