CtroEnv
ctroenvType-Safe Environment Variables
Getting StartedQuick StartCore Concepts
defineEnv()string()number()boolean()pick()Chainable MethodsRefinementsError HandlingSchema Composition
CLI Overviewctroenv validatectroenv generatectroenv checkctroenv docsctroenv initCLI Configuration
Node AdapterVite AdapterNext.js Adapter
Migration from t3-envMigration from envalidMigration from dotenv

ctroenv check

CI-friendly command that validates env vars and exits with the appropriate code.

  1. Docs
  2. CLI

ctroenv check

CI-friendly validation command. Designed for continuous integration pipelines.

Usage

ctroenv check [options]

Options

OptionTypeDefaultDescription
--sourcestring.envPath to the env file to check
--strictbooleanfalseValidate values against schema (not just keys)
--jsonbooleanfalseOutput 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

CodeMeaning
0All variables valid
1Validation errors found
2Configuration 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 --strict

How is this guide?

Edit on GitHub

Last updated on Jun 24, 2026

Previousctroenv generateNextctroenv docs

On this page

UsageOptionsCI IntegrationExit CodesStrict Mode