I want to know what strategies, tools you use to keep your production environment variables separate from your local development environment variables.
I use a module named "config". It supports multiple configurations, machine based, environment based, and you can even pass overrides at command line when starting your app.
I create one .json file in various development / staging / production server which looks like below.
{
"host": "local OR staging OR production";
}
Then in code.
const env = require('./env.json') || {"host": "local"};
And use env.host everywhere. I don't create a .json file in the local system.
No dependency on module or process. Give it a shot. It works for me
Peter Scheler
JS enthusiast
I use PM2s "Process File".