@nitra/check-env
v4.1.1
Published
Check that the critical environment variables are set
Readme
check-env
Check that the critical environment variables are set for your app, and that you did not leave dangerous development overrides in production.
Installation
bun add @nitra/check-envUsage
import checkEnv from '@nitra/check-env'
checkEnv(
// Will log an error and throw if any of these are missing:
[
'SOME_API_SECRET',
'PRIVATE_TOKEN',
'SOME_OTHER_IMPORTANT_THING'
// ...
]
)If some required environment variable are not set, it will tell you and throw
an error at the end:

SKIP_CHECK_ENV
If the SKIP_CHECK_ENV environment variable is set, the library will skip required variable checks and will not throw. This can be useful for local development or specific CI scenarios.
SKIP_CHECK_ENV=1 bun node app.js- With
SKIP_CHECK_ENVenabled, you'll see a warning in logs:SKIP_CHECK_ENV is set, skipping environment variable check. - The exported
envwill behave like plainprocess.env(no proxy checks for prior validation).
License
MIT - Made with ❤️ by François Best
Using this package at work ? Sponsor me to help with support and maintenance.
