clean-env

1.0.0 • Public • Published

clean-env

NPM

Ensure the correct env variables are being used for production builds

Installation

npm install clean-env --save-dev

Usage

Config

Create a JavaScript, JSON or YAML file, or skip the config an embed in the package.json file under the key clean-env.

If you make a file, it must be one of the following names and stored in the root of the project folder:

  • .clean-env.js
  • .clean-env.json
  • .clean-env.yaml
  • .clean-env.yml

Then add any key to over write these defaults:

{
    "required": [],
    "excluded": [],
    "dotenv": ".env",
}

dotenv

If you need to privide an alternative path to your .env file, then over write the dotenv key in the config with the correct name, relative to the root of the project.

{
    dotenv: './config/.env'
}

If you would like to not load the .env file before checking the ENV for variables, then change the dotenv key to false.

dotenv: false

Translations

If you require a translated version of this script or would like to change the wording of any of the error messages, then add a translations key to the config and over write any of these defaults:

translations:
    missingRequired: "Clean ENV did not find the following required ENV variables."
    foundExcluded: "Clean ENV has found the following excluded ENV variables in the ENV."
    errorStatement: "Your ENV is not in a clean state."
    errorQuestion: "Are you sure you want to continue with the build? (y)"
    yes: "y"

Contributing

  1. Fork it on Github https://github.com/alexbbt/node-clean-env
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request against the development branch :D

Readme

Keywords

none

Package Sidebar

Install

npm i clean-env

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

12.1 kB

Total Files

8

Last publish

Collaborators

  • alexbbt