Commit 1fe7c6d6 authored by Kamron Aroonrua's avatar Kamron Aroonrua 💬

config loader

parent 35fbd086
module.exports = { var fs = require('fs');
'amqp' : require('./amqp.json'),
'memstore' : require('./memstore.json'), var cfg = {
'storage' : require('./storage.json'), 'amqp' : cfg_load('amqp.json'),
'memstore' : cfg_load('memstore.json'),
'storage' : cfg_load('storage.json'),
'auth' : { 'auth' : {
'secret': require('./secret.json'), 'secret': cfg_load('secret.json'),
'acl' : require('./acl.json') 'acl' : cfg_load('acl.json')
} }
} }
function cfg_load(fd)
{
var ret = {};
if(fs.existsSync(__dirname + '/' + fd)){
ret = require(__dirname + '/' + fd);
}else if(fs.existsSync(__dirname + '/template/' + fd)){
ret = require(__dirname + '/template/' + fd);
}
return ret;
}
module.exports = cfg;
\ No newline at end of file
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
"bson": "^0.5.6", "bson": "^0.5.6",
"buffalo": "^0.1.3", "buffalo": "^0.1.3",
"dateformat": "^1.0.12", "dateformat": "^1.0.12",
"dot-object": "^1.9.0",
"express": "^4.14.0", "express": "^4.14.0",
"express-jwt": "^5.3.1", "express-jwt": "^5.3.1",
"ioredis": "^2.5.0", "ioredis": "^2.5.0",
"jsonwebtoken": "^8.2.2", "jsonwebtoken": "^8.2.2",
"microgear": "^0.8.1",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"moment": "^2.17.1", "moment": "^2.17.1",
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
"node-uuid": "^1.4.7", "node-uuid": "^1.4.7",
"object-hash": "^1.1.8", "object-hash": "^1.1.8",
"pm2": "^2.4.0", "pm2": "^2.4.0",
"qs": "^6.8.0",
"query-string": "^4.2.3", "query-string": "^4.2.3",
"quickq": "^0.8.1", "quickq": "^0.8.1",
"random-access-file": "^1.3.0", "random-access-file": "^1.3.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment