MCPcopy Create free account
hub / github.com/parse-community/parse-server / parseConfigFile

Function parseConfigFile

src/cli/utils/commander.js:76–103  ·  view source on GitHub ↗
(program)

Source from the content-addressed store, hash-verified

74}
75
76function parseConfigFile(program) {
77 let options = {};
78 if (program.args.length > 0) {
79 let jsonPath = program.args[0];
80 jsonPath = path.resolve(jsonPath);
81 const jsonConfig = require(jsonPath);
82 if (jsonConfig.apps) {
83 if (jsonConfig.apps.length > 1) {
84 throw 'Multiple apps are not supported';
85 }
86 options = jsonConfig.apps[0];
87 } else {
88 options = jsonConfig;
89 }
90 Object.keys(options).forEach(key => {
91 const value = options[key];
92 if (!_definitions[key]) {
93 throw `error: unknown option ${key}`;
94 }
95 const action = _definitions[key].action;
96 if (action) {
97 options[key] = action(value);
98 }
99 });
100 console.log(`Configuration loaded from ${jsonPath}`);
101 }
102 return options;
103}
104
105Command.prototype.setValuesIfNeeded = function (options) {
106 Object.keys(options).forEach(key => {

Callers 1

commander.jsFile · 0.85

Calls 2

actionFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…