envc

Loads environment variables from dotenv files

MIT 14 个版本
安装
npm install envc
yarn add envc
pnpm add envc
bun add envc
README

envc Build Status NPM version NPM downloads LICENSE

Loads environment variables from .env files.

Inspired by dotenv by Brandon Keepers.

Usage

// `options` are optional
var env = require('envc')(options);

Options:

  • path: Path to the .env file [optional, default: cwd]
  • name: Name of the .env file [optional, default: '.env']
  • nodeenv: NODE_ENV [optional, default: process.env.NODE_ENV]
  • booleans: enable boolean parsing, [optional, default: false]
  • numbers: enable number parsing, [optional, default: false]
  • readonly: load and parse .env file only (i.e. does not modify process.env), [optional, default: false]
  • overwrite: allow process.env to overwrite file values [optional, default: false]

Inheritance

envc will try to load:

  • {name}
  • {name}.{NODE_ENV}
  • {name}.local

Interpolation

URL_HOST="vesln.com"
URL_PATH="index"
URL_FULL="http://${URL_HOST}/${URL_PATH}"
DOCKER_SERVICE=$(boot2docker ip):11211 # works on node 0.12+

Installation

npm install envc

License

MIT

版本列表
2.5.0 2017-02-20
2.4.1 2015-10-26
2.4.0 2015-08-31
2.3.2 2015-08-13
2.3.1 2015-07-30
2.3.0 2015-07-20
2.2.0 2015-04-03
2.1.0 2015-02-04
2.0.1 2015-01-26
2.0.0 2014-11-14
2.0.0-alpha1 2014-09-15
1.1.1 2014-03-23
1.1.0 2014-03-23
1.0.0 2014-01-25