@demimonde/dotenv
@demimonde/dotenv
will Read Environment Variables From The .env File Into process.env.
yarn add -E @demimonde/dotenv
Table Of Contents
API
The package is available by importing its default function:
import dotenv from '@demimonde/dotenv'
dotenv(
config: Config,
): void
Call this function to get the result you want.
Config
: Options for the program.
Name | Type | Description | Default |
---|---|---|---|
silent | boolean | Do not print the names of read env variables. | false |
location | string | The location where to look up the .env file. |
~ |
name | string | The name of the .env file. |
.env |
With the following .env
file:
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=storage1234;AccountKey=hjaskd12t73DGHJs/duiSDue7687dgqbmn2BDS==;EndpointSuffix=core.windows.net
STORAGE=storage1234
CONTAINER=my-new-package
SECRET=facebook-secret
The next example will add 4 env variables.
/* yarn example/ */
import dotenv from '@demimonde/dotenv'
dotenv()
[+] AZURE_STORAGE_CONNECTION_STRING [+] STORAGE [+] CONTAINER [+] SECRET
Copyright
(c) Demimonde 2018