Detalhes do pacote

@demimonde/dotenv

demimonde78MIT1.1.0

Read Environment Variables From The .env File Into process.env.

dotenv, demimonde

readme (leia-me)

@demimonde/dotenv

npm version

@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

changelog (log de mudanças)

17 August 2019

1.1.0

  • [feature] Pass the name of the .env file.

11 December 2018

1.0.0