Validate your .env before your app crashes at 3am.
You deploy. The app starts. Then it dies because DATABASE_URL doesn't exist in production. envshield catches that before a single request is served.
Write a schema:
# .env.schema
DATABASE_URL=required
STRIPE_SECRET_KEY=required
PORT=3000
LOG_LEVEL=info
Then run:
npx @neocrev/envshieldIf something's missing, you'll know immediately.
# CI
- run: npx @neocrev/envshield --strictCOPY .env.schema ./
RUN npx @neocrev/envshield# pre-commit hook
npx @neocrev/envshield --strict| Flag | Description | Default |
|---|---|---|
-s, --schema |
Path to schema file | .env.schema |
-e, --env |
Path to env file | .env |
-t, --strict |
Fail on missing required fields | warn only |
-i, --init |
Generate schema from .env.example |
|
-h, --help |
Show help |
MIT