This small lib offers you the ability to edit your .env files without the need to restart the process.
process.env.YourVars will auto updated every time you save .env file.
npm install env-hot-reload
oryarn add env-hot-reload
- Include it in your project :
const envHotReloader = require('env-hot-reload');
new envHotReloader({
onEnvChange: myFunctToCall, // optionall callback function runs on every .env update
watchInterval: 1500 // optionall default 3500
}).watch()
function myFunctToCall() {
// your code to run on .env is updated...
}
const envHotReloader = require('env-hot-reload');
const config = {
onEnvChange: myFunctToCall, // optionall callback Function runs on every .env update
watchInterval: 1500 // optionall default 3500
}
const monitor = new envHotReloader(config)
monitor.watch();
function myFunctToCall() {
// your code to run when .env is updated...
}