hotenv

1.0.1 • Public • Published

HotEnv

With this module you can programmatically reload environment variables. You can also attempt to evaluate/guess the variables themselves: a string would be converted into boolean, number, array, or json object (in this order). If none of these conversions has success the value type remains "string".

let hotenv = require('hotenv');
hotenv(); // by default it loads process.cwd()+'/.env' file
 
// somewhere in the code...
hotenv(__dirname+'/.env2', true) // this will let you override or add new values (with type guessing).
 
// somewhere in the code...
hotenv(__dirname+'/.env') // this will let you refresh original env values (but it keeps the added ones in the previous step) or any other value if .env has been modified

Dependents (0)

Package Sidebar

Install

npm i hotenv

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

5.42 kB

Total Files

3

Last publish

Collaborators

  • michelemilani