dotenvyjs
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

dotenvyjs

DotEnvyJs is a wrapper utility around envalid and dotconfig

Installation

npm install dotenvyjs

WorkFlow

Create a file named .env.example that can be commited and shared across the team.

Place you keys and values of your application in form of an example / validator. The format is KEY=validator_name(defaultValue,choice1|choice2)

Check below an example of a .env.example file:

# .env.example

API_KEY=str()
CI_ENV=str(stage,development|production)

In the above exemplo, API_KEY is required, with no default value. In this case, when app run, if API_KEY was not found in process.env, application will fail start.

All validators are envalid validators.

Usage

const dotenvyjs = require('dotenvyjs')

const envalidOptions = {
  strict: true
}

const options = {
  exampleFile: '.env.example',
  dir: __dirname,
  ...envalidOptions
}
const env = dotenvyjs(options)

module.exports = {
    ...env
}

Package Sidebar

Install

npm i dotenvyjs

Weekly Downloads

0

Version

0.0.5

License

ISC

Unpacked Size

9.71 kB

Total Files

7

Last publish

Collaborators

  • jpolvora