Prerequisites
Before starting, make sure you have installed envcheck.Your First Environment Check
Let’s create your first environment validation in just a few steps.Initialize Configuration
Generate a default You should see:This creates a
.envcheck.yaml configuration file:.envcheck.yaml file with sensible defaults:Run Your First Check
Execute envcheck to validate your environment:You’ll see output showing which checks passed and which failed:
Customize Your Configuration
Now let’s customize the configuration for your specific project needs.Example: Node.js Project
For a typical Node.js web application:Example: Go Project
For a Go application:Advanced Usage
Custom Configuration Path
Use a configuration file from a different location:Verbose Output
Get detailed information about what envcheck is doing:JSON Output for CI/CD
Export results in JSON format for integration with CI/CD pipelines:Exit Codes
envcheck returns appropriate exit codes for scripting:0- All checks passed- Non-zero - One or more checks failed
Integration Examples
Git Pre-commit Hook
Add envcheck to your pre-commit hook (.git/hooks/pre-commit):
GitHub Actions
Integrate envcheck into your CI pipeline:Docker
Validate the environment inside Docker containers:Configuration Reference
Tools Section
Validate installed tools and their versions:>=, <=, >, <, =, ^, ~
Environment Variables Section
Check environment variables:Ports Section
Verify port availability:Files Section
Validate file and directory existence:Network Section
Check network connectivity:Tips and Best Practices
Start Simple
Begin with basic checks (tools and files) and gradually add more validators as your project grows.
Version Control
Always commit
.envcheck.yaml to version control so all team members use the same validation rules.Optional vs Required
Use
required: false for optional tools or files that enhance development but aren’t strictly necessary.Semver Ranges
Use flexible version ranges (e.g.,
>=18.0.0) rather than exact versions to avoid unnecessary failures.