A too simple config loader.
appconfg.js:
var root = __dirname + '/';
module.exports = {
appRoot : root,
publicDir : 'public/',
frontendMain : 'index.html',
dbConfigName : 'dbConfig.js',
listeningPort : process.env.PORT || '8000'
};
app.js:
var config = require('load-appconfig');
var appRoot = config.appRoot;
var dbConfig = require(appRoot + config.dbConfigName);
No paths needed to load config.
- Node.js
- File named appConfig.js in the root of your node app
$ npm install load-appconfig