ctroenv check
CI-friendly command that validates env vars and exits with the appropriate code.
ctroenv check
CI-friendly validation command. Designed for continuous integration pipelines.
Usage
ctroenv check [options]
Options
| Option | Type | Default | Description |
|---|---|---|---|
--source | string | .env | Path to the env file to check |
--strict | boolean | false | Validate values against schema (not just keys) |
--json | boolean | false | Output as JSON |
CI Integration
# .github/workflows/env-check.yml
name: Environment Check
on: [pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npx ctroenv check
Exit Codes
| Code | Meaning |
|---|---|
0 | All variables valid |
1 | Validation errors found |
2 | Configuration error |
Combine with .env.example in CI:
# Validate against the example file (all required vars present)
ctroenv check --source .env.example
# Strict mode: validate values against schema validators
ctroenv check --source .env --strict
Strict Mode
Without --strict, check only compares key sets — it reports missing and
unused keys but does not validate values.
With --strict, each value is validated against its schema validator (same as
ctroenv validate). This catches type mismatches, invalid URLs, out-of-range
numbers, and other value-level errors.
# Key comparison only (fast)
ctroenv check --source .env
# Key comparison + value validation
ctroenv check --source .env --strictHow is this guide?
Last updated on Jun 24, 2026