envc
v2.5.0
Published
Loads environment variables from dotenv files
Downloads
80
Readme
envc
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 modifyprocess.env
), [optional, default:false
]overwrite
: allowprocess.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