nodejs config module optimist or nconf?
I use a config.js file like this:
var config = {} config.web = {}; config.debug = {}; config.server_name = 'MyServerName'; config.web.port = process.env.WEB_PORT || 32768; config.debug.verbositylevel = 3; module.exports = config;
then i can just call config variables like this:
var port = config.web.port;
I find it much easier to maintain like this. Hope that helps you.
I use dotenv. It's as easy as:
var dotenv = require('dotenv');
dotenv.load();
Then you just create a .env file with your configuration settings.
S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE
Disclaimer: I'm the creator, and didn't find the config.json file approach useful in production environments. I prefer getting configuration from my environment variables.