cascading-service-config
Advanced tools
Comparing version 1.0.0 to 1.1.0
var url = require('url'); | ||
module.exports = function(config, domain) { | ||
if (!config[domain]) throw new Error(domain + ' is not a valid domain'); | ||
config = JSON.parse(JSON.stringify(config)); | ||
@@ -20,3 +18,3 @@ | ||
return config[domain]; | ||
return config[domain] || config; | ||
}; |
{ | ||
"name": "cascading-service-config", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "dry configuration for a multi-service system", | ||
@@ -5,0 +5,0 @@ "main": "csc.js", |
@@ -166,1 +166,6 @@ # Cascading Service Config | ||
``` | ||
## `csc(configSourceObject, [domain])` | ||
Reads a cascading service config file and returns a config for the given domain. | ||
If the domain does not exist, the root config is returned. |
@@ -46,2 +46,6 @@ var csc = require('../'); | ||
}); | ||
it('should return root config when given domain doesnt exist', function() { | ||
var config = csc(lolconfig, 'potato'); | ||
assert.equal(config.sahti.port, 6003); | ||
}); | ||
it('non-service root objects should also inherit service locations', function() { | ||
@@ -48,0 +52,0 @@ var config = csc(lolconfig, 'stout'); |
8182
75
171