Commit 167f5484 authored by Leo Iannacone's avatar Leo Iannacone

use extend module to merge configurations - closes #2

parent a3b29d9f
# #
# * Please DO NOT edit this file. # * Please DO NOT edit this file.
# * # *
...@@ -6,6 +5,8 @@ ...@@ -6,6 +5,8 @@
# * # *
# #
extend = require('extend')
# #start config-auto-export # #start config-auto-export
config = {} config = {}
...@@ -101,18 +102,7 @@ try ...@@ -101,18 +102,7 @@ try
if user_config if user_config
console.log "Reading user configutation ..." console.log "Reading user configutation ..."
# * update object1 with object2 values # * update object1 with object2 values
_merge = (object1, object2) -> config = extend(true, {}, config, require(user_config))
result = {}
for p of object1
if object2.hasOwnProperty(p)
if typeof object1[p] is "object" and typeof object2[p] is "object"
result[p] = _merge(object1[p], object2[p])
else
result[p] = object2[p]
else
result[p] = object1[p]
return result
config = _merge(config, require(user_config))
else else
console.log "No user config specified. Using global settings." console.log "No user config specified. Using global settings."
catch err catch err
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"errorhandler ": "*", "errorhandler ": "*",
"ejs": ">= 0.0.1", "ejs": ">= 0.0.1",
"socket.io": "1.*", "socket.io": "1.*",
"tail": "*" "tail": "*",
"extend": "~1.3.0"
}, },
"scripts": { "scripts": {
"install": "bash scripts/install.sh", "install": "bash scripts/install.sh",
......
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