1.0.0 • Published 4 years ago
read-dotenv v1.0.0
read-dotenv
read a .env file into an object
Installation
$ npm install read-dotenv --saveUsage
import dotenv from 'read-dotenv'Example
# .env
PORT=7777
HOST=my.host.com// app.js
import dotenv from 'read-dotenv'
const env = dotenv({
PORT: 3000,
HOST: 'localhost',
SOME: 'other option'
})
// `env` is now:
{
PORT: 7777,
HOST: 'my.host.com',
SOME: 'other option',
}API
▸ dotenv(env?, root?): Record<string, any>
Parameters
| Name | Type | Description |
|---|---|---|
env | Record<string, any> | The environment default object |
root | string | The path where .env lives (default: process.cwd()) |
License
MIT
1.0.0
4 years ago