@salestrip/env

2.0.0 • Public • Published

@salestrip/env

Environment variable management and utilities.

Install

npm i @salestrip/env

Usage

Please refer to the test suite for more details.

const env = require('@salestrip/env')

// access process.env.NODE_ENV
const NODE_ENV = env.get('NODE_ENV')

// sets FOO_BAR to 'whatever' if process.env.FOO_BAR is undefined
const FOO_BAR = env.get('FOO_BAR', 'whatever')

// sets FOO_BAR and process.env.FOO_BAR to 'whatever'
const FOO_BAR = env.set('FOO_BAR', 'whatever')

// deletes process.env.FOO_BAR and returns undefined
env.set('FOO_BAR')

// sets FOO_BAR and process.env.FOO_BAR to 'whatever' if process.env.FOO_BAR is undefined
const FOO_BAR = env.ensure('FOO_BAR', 'whatever')

// if process.env.FOO_BAR is 'something' sets FOO_BAR to 'something' (ignores fallback value)
const FOO_BAR = env.ensure('FOO_BAR', 'whatever')

// sets DB_URL and throws helpful error if process.env.DB_URL is undefined
const DB_URL = env.need('DB_URL')

Release

To release a new version, use npm. Using npm version will update the version in package.json before committing the resulting file change to git and adding the appropriate git tag. Pushing a tagged version to origin will trigger a CI deployment to the npm registry.

To release a bugfix update the patch version.

npm version patch
git push
git push --tags

To release a feature update the minor version.

npm version minor
git push
git push --tags

To release a breaking change update the major version.

npm version major
git push
git push --tags

License

Copyright © 2018-2019 SalesTrip Limited. All rights reserved.

Readme

Keywords

Package Sidebar

Install

npm i @salestrip/env

Weekly Downloads

124

Version

2.0.0

License

MIT

Unpacked Size

9.48 kB

Total Files

14

Last publish

Collaborators

  • srivai.vignesh
  • gmanojkumar
  • jmelville
  • vinodkrsalestrip
  • hemanthstrip