0.2.1 • Published 3 years ago

dotenv-ts v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

dotenv-ts

load environment variables from .env file, into process.env

NPM Version

Install

in production mode, use real environment variables instead

npm i -D dotenv-ts

Usage

require('dotenv-ts').config()

or with options

require('dotenv-ts').config(options)

Options

KeyrequiredTypeDefaultDescription
dirnamenostringprocess.cwd()path to find .env file
modenostringprocess.env.NODE_ENV or "dev"mode to determine additional .env file's name. one of prod, dev, test, debug
canOverwritenobooleanfalsespecify whether .env variables can overwrite process.env. if not, conflicting key will logged and not applied.
priorityyes"local" or "mode" or undefined"local"determines which file's value will be used when .env.${mode} and .env.local has same key. if unspecified(undefined) and has conflicting key, error will thrown
variablesnoObjectprocess.envkey-value store for variables - used to resolve variables
shareVariablesyesbooleantrueshare variables cross file (can reference variable in another file)

Required options' default value is used if no option provided.

WARN: If option object is passed but required option is not set, the value will be undefined which can lead to unexpected behavior

Feature

load environment variable from .env file into process.env

supports multiline and variable resolution also

Notice

There may be any breaking changes before the first stable version.

License

MIT

0.2.1

3 years ago

0.2.0

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

1.0.0

4 years ago