hoodly
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i hoodly

Weekly Downloads

0

Version

0.0.1

License

ISC

Unpacked Size

20.7 kB

Total Files

6

Last publish

Collaborators

  • osofem