Commit adbad884 authored by Leo Iannacone's avatar Leo Iannacone

read user.config.js and merge it with global configuration - exports merged configuration

parent 272533fc
...@@ -87,4 +87,35 @@ config.web.status = config.status ...@@ -87,4 +87,35 @@ config.web.status = config.status
config.web.host = config.host config.web.host = config.host
config.web.hostname = config.host + ((config.port == 80) ? '' : ':' + config.port) config.web.hostname = config.host + ((config.port == 80) ? '' : ':' + config.port)
module.exports = config
// read user configuration and merge it
/*
* update object1 with object2 values
*/
function _merge(object1, object2) {
var result = {}
for (p in object1) {
if (object2.hasOwnProperty(p)) {
if (typeof object1[p] === 'object' && typeof object2[p] === 'object') {
result[p] = _merge(object1[p], object2[p])
}
else {
result[p] = object2[p]
}
}
else {
result[p] = object1[p]
}
}
return result
}
try {
user_config = require('../user.config.js')
console.log("Reading user configutation ...")
module.exports = _merge(config, user_config)
} catch (err) {
consol.log("error reading user configutation", err)
module.exports = config
}
\ No newline at end of file
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