Comparing version 1.0.0 to 1.1.0
@@ -6,3 +6,4 @@ 'use strict'; | ||
_ = require('underscore'), | ||
async = require('async'); | ||
async = require('async'), | ||
deepExtend = require('deep-extend'); | ||
@@ -89,3 +90,3 @@ /** | ||
var envConfig = configHash[env]; | ||
var mergedConfig = _.defaults(envConfig, defaultConfig); | ||
var mergedConfig = deepExtend({}, defaultConfig, envConfig); | ||
cb(null, mergedConfig); | ||
@@ -92,0 +93,0 @@ } |
{ | ||
"name": "confide", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "simple app configuration", | ||
"contributors": ["Nicholas Cloud <ncloud@appendto.com>"], | ||
"keywords": ["configuration", "config"], | ||
"license": "MIT", | ||
"license": "LICENSE", | ||
"main": "confide.js", | ||
@@ -15,3 +15,4 @@ "repository": { | ||
"underscore": "latest", | ||
"async": "latest" | ||
"async": "latest", | ||
"deep-extend": "latest" | ||
}, | ||
@@ -26,3 +27,2 @@ "devDependencies": { | ||
} | ||
} |
@@ -56,2 +56,21 @@ /*global suite, test, setup, teardown*/ | ||
test('should load merged environment at multiple levels (deep extend)', function (done) { | ||
var config = confide({configDir: CONFIG_DIR}); | ||
config.load('development', function (err, mergedConfig) { | ||
var level; | ||
assert.property(mergedConfig, 'level1'); //default & development | ||
assert.isObject(mergedConfig.level1); | ||
level = mergedConfig.level1; | ||
assert.property(level, 'atLevel1'); //development | ||
assert.isTrue(level.atLevel1); | ||
assert.property(level, 'level2'); //default & development | ||
assert.isObject(level.level2); | ||
level = level.level2; | ||
assert.property(level, 'atLevel2'); //development | ||
assert.property(level, 'level3'); //default | ||
assert.isTrue(level.level3); //default | ||
done(); | ||
}); | ||
}); | ||
test('should err if no default environment specified, and env parameter absent', function (done) { | ||
@@ -58,0 +77,0 @@ var config = confide({configDir: CONFIG_DIR, defaultEnv: ''}); |
{ | ||
"configName": "default", | ||
"defaultOnly": true | ||
"defaultOnly": true, | ||
"level1": { | ||
"level2": { | ||
"level3": true | ||
} | ||
} | ||
} |
{ | ||
"configName": "development", | ||
"developmentOnly": true | ||
"developmentOnly": true, | ||
"level1": { | ||
"atLevel1": true, | ||
"level2": { | ||
"atLevel2": true | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23923
382
3
1
+ Addeddeep-extend@latest
+ Addeddeep-extend@0.6.0(transitive)