Merge pull request #979 from ParsePlatform/flovilmart.SupportDashboardLikeConfig

Adds support for apps key in config file, throws if length is > 1
This commit is contained in:
Florent Vilmart
2016-03-16 22:43:58 -04:00

View File

@@ -38,12 +38,20 @@ let options = {};
if (program.args.length > 0 ) { if (program.args.length > 0 ) {
let jsonPath = program.args[0]; let jsonPath = program.args[0];
jsonPath = path.resolve(jsonPath); jsonPath = path.resolve(jsonPath);
options = require(jsonPath); let jsonConfig = require(jsonPath);
if (jsonConfig.apps) {
if (jsonConfig.apps.length > 1) {
throw 'Multiple apps are not supported';
}
options = jsonConfig.apps[0];
} else {
options = jsonConfig;
}
console.log(`Configuation loaded from ${jsonPath}`) console.log(`Configuation loaded from ${jsonPath}`)
} }
options = Object.keys(definitions).reduce(function (options, key) { options = Object.keys(definitions).reduce(function (options, key) {
if (program[key]) { if (typeof program[key] !== 'undefined') {
options[key] = program[key]; options[key] = program[key];
} }
return options; return options;