Environment variable validation for Node.js
After a long wait, version 8 is here!
A couple small changes to the default reporter
Version 7 is a major release with several breaking changes. If you've been using the recommended "strict mode" from previous releases, the migration should be fairly straightforward as it's now turned on by default (you can remove the strict: true
option). Below are the list of changes:
strict
is removed, and its behavior is enabled by default. This means:
validators
.strictProxyMiddleware
, but it's not
recommended (see "Custom Middleware", in the README).dotenv
package is no longer shipped as part of this library. You can easily use it directly
by installing it and running require('dotenv').config()
before you invoke envalid's cleanEnv()
transformer
validator option is gone, replaced by the ability to add custom middlewarehost
and ip
validators are now slightly less exhaustive. If you need these to be airtight, use
your own custom validator insteadNODE_ENV
support is now less opinionated, and an error is no longer thrown if a value other
than production
/development
/test
is passed in. You can provide your own validator for NODE_ENV
to get exactly the behavior you want. The isDev
, isProduction
, etc properties still work as
before, and are implemented as middleware so you can override their behavior as needed.Version 7 of Envalid is finally ready for public consumption. Thanks to @KATT and @SimenB for their help and feedback on the (long-running) PR.
Please try it out in your project with npm install [email protected]
or yarn add [email protected]
and report any bugs, errors, or unexpected behavior (after reading the changes below!). A stable release will follow once any bugs are shaken out.
strict
is removed, and its behavior is enabled by default. This means:
validators
.strictProxyMiddleware
, but it's not
recommended (see "Custom Middleware", below).dotenv
package is no longer shipped as part of this library. You can easily use it directly
by installing it and running require('dotenv').config()
before you invoke envalid's cleanEnv()
transformer
validator option is gone, replaced by the ability to add custom middlewarehost
and ip
validators are now slightly less exhaustive. If you need these to be airtight, use
your own custom validator insteadNODE_ENV
support is now less opinionated, and an error is no longer thrown if a value other
than production
/development
/test
is passed in. You can provide your own validator for NODE_ENV
to get exactly the behavior you want. The isDev
, isProduction
, etc properties still work as
before, and are implemented as middleware so you can override their behavior as needed.Tightening up of the TypeScript typings. See #112 and #114
Changes are pretty minimal here, mostly just dependency updates. The only reason it's a major version is because Node 6.x is no longer supported. The minimum Node version is now 8.12.0.
This is a breaking (but worthwhile) change if you use TypeScript. If you use regular JS it's a very minor update.
browser
field to package.json to bypass the dotenv
integration. This should be useful for usage with react-nativeThanks to all the contributors!
port
defaultshost
and port
validators (#55)prettier
to enforce style conventions (#49)Thanks in particular to @SimenB and @kachkaev for all their work and feedback that went into this release!