node-settings
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -30,8 +30,8 @@ (function() { | ||
return config_loader.get(this.source.options, function(data) { | ||
var config, env_config; | ||
var config, env_config, result; | ||
config = data["default"] || {}; | ||
env_config = data[_this.environment]; | ||
if (env_config) merge(config, env_config); | ||
env_config = data[_this.environment] || {}; | ||
result = merge(config, env_config); | ||
return process.nextTick(function() { | ||
return callback(config); | ||
return callback(result); | ||
}); | ||
@@ -42,9 +42,9 @@ }); | ||
Configurator.prototype.loadSync = function() { | ||
var config, config_loader, data, env_config; | ||
var config, config_loader, data, env_config, result; | ||
config_loader = Configurator.config_sources[this.source.name]; | ||
data = config_loader.getSync(this.source.options); | ||
config = data["default"] || {}; | ||
env_config = data[this.environment]; | ||
if (env_config) merge(config, env_config); | ||
return config; | ||
env_config = data[this.environment] || {}; | ||
result = merge(config, env_config); | ||
return result; | ||
}; | ||
@@ -60,5 +60,5 @@ | ||
return fs.readFile(options.location, options.encoding || 'ascii', function(err, data) { | ||
if (err) throw err; | ||
return process.nextTick(function() { | ||
return callback(JSON.parse(data)); | ||
if (!err) callback(null, JSON.parse(data)); | ||
if (err) return callback(err, null); | ||
}); | ||
@@ -65,0 +65,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"description": "Provides easy, multi-environment configuration", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"homepage": "", | ||
@@ -21,4 +21,6 @@ "repository": { | ||
"devDependencies": { | ||
"jasmine-node": "latest" | ||
"mocha" : "1.0.0", | ||
"should" : "0.6.0", | ||
"coffee-script" : "1.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
9431
3