Added code to allow model-config to respect model-config.local.js and model-config.env.js as do other config files.

This commit is contained in:
Dennis Ashby 2015-07-25 09:56:28 -07:00
parent 4f6e768426
commit 41af081c55
1 changed files with 11 additions and 1 deletions

View File

@ -32,7 +32,8 @@ ConfigLoader.loadDataSources = function(rootDir, env) {
*/
ConfigLoader.loadModels = function(rootDir, env) {
/*jshint unused:false */
return tryReadJsonConfig(rootDir, 'model-config') || {};
//return tryReadJsonConfig(rootDir, 'model-config') || {};
return loadNamed(rootDir, env, 'model-config', mergeModelConfig);
};
/**
@ -148,6 +149,15 @@ function mergeDataSourceConfig(target, config, fileName) {
}
}
function mergeModelConfig(target, config, fileName) {
for (var mc in target) {
var err = mergeObjects(target[mc], config[mc]);
if (err) {
throw new Error('Cannot apply ' + fileName + ' to `' + mc + '`: ' + err);
}
}
}
function mergeAppConfig(target, config, fileName) {
var err = mergeObjects(target, config);
if (err) {