[go: up one dir, main page]

Skip to content
/ hoodly Public

A nodejs module for loading .env file into process.env

Notifications You must be signed in to change notification settings

osofem/hoodly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hoodly

A nodejs module for loading .env file into process.env.

Usage

Typical usage

require("hoodly").load();

For this, the .env file needs to be in the current working directory and any preset variable in process.env will not be overwritten.

Force Overwriting, Debugging and Specifying .env directory path

To force overwriting of preset variables:

require("hoodly").load({force: true});

To log out information for debug purposes

require("hoodly").load({debug: true});

To specify directory path of your .env file (defaults to current working directory of your project).

require("hoodly").load({pathToEnv: '/tmp/files/'});

Complete Options

require("hoodly").load({pathToEnv: '/tmp/files/', force: true, debug: true});

Your .env file

Your .env file should have variables in the format key=value separated by new line. There should not be quotes around your value (unless you intend it to be so).

NOTE: do NOT include comment in your .env file. Do NOT include quotes in your value (unless you intend it to be so).

FOO=This is foo! //resolves to FOO:"This is foo!"
BAR=This is the legendary bar that is = to pi //resolves to BAR:"This is the legendary bar that is = to pi"
FOO = This is foo! //resolves to FOO:"This is foo!"
BAR="This is the legendary bar that is = to pi" //resolves to BAR:'"This is the legendary bar that is = to pi"'
FOO= //resolves to FOO:""
//These will not resolve
FOO //fails to resolve
"BOO"="This boy" //fails to resolve

About

A nodejs module for loading .env file into process.env

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published