Skip to content

popoybvargas/dotenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

zv-dotenv

Get configuration file and load entries as environment variables.

Basic Usage

require('zv-dotenv')();

The above code loads configurations specified in the .env file in the application's root directory.

Use the above code as soon as possible (topmost part) in the main (e.g. index.js or app.js) script.

To load configurations from a custom file, specify its absolute path as an argument, e.g.

require('zv-dotenv')(PATH_TO_CUSTOM_CONFIG_FILE);

Configurations will now be loaded as part of the application's environment variables process.env. To access configurations, e.g.

  • .env
DATABASE_USER=user
DATABASE_PASSWORD=password
console.log(process.env.DATABASE_USER, process.env.DATABASE_PASSWORD);

// outputs user password

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published