Change arg check from truthy to defined (#3143)

Show log on master when using cluster
This commit is contained in:
Steven Shipton
2016-11-30 13:48:49 +00:00
committed by Florent Vilmart
parent bd1689190f
commit 143bd11638
3 changed files with 15 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ import runner from './utils/runner';
const help = function(){
console.log(' Get Started guide:');
console.log('');
console.log(' Please have a look at the get started guide!')
console.log(' Please have a look at the get started guide!');
console.log(' https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide');
console.log('');
console.log('');
@@ -35,7 +35,7 @@ function startServer(options, callback) {
app.use(options.mountPath, api);
var server = app.listen(options.port, callback);
let server = app.listen(options.port, callback);
server.on('connection', initializeConnections);
if (options.startLiveQueryServer || options.liveQueryServerOptions) {
@@ -69,7 +69,7 @@ function startServer(options, callback) {
}
}
var handleShutdown = function() {
let handleShutdown = function() {
console.log('Termination signal received. Shutting down.');
destroyAliveConnections();
server.close(function () {
@@ -112,7 +112,8 @@ runner({
if (options.cluster) {
const numCPUs = typeof options.cluster === 'number' ? options.cluster : os.cpus().length;
if (cluster.isMaster) {
for(var i = 0; i < numCPUs; i++) {
logOptions();
for(let i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', (worker, code) => {
@@ -132,6 +133,6 @@ runner({
});
}
}
})
});
/* eslint-enable no-console */

View File

@@ -47,7 +47,7 @@ Command.prototype.loadDefinitions = function(definitions) {
});
console.log('');
});
}
};
function parseEnvironment(env = {}) {
return Object.keys(_reverseDefinitions).reduce((options, key) => {
@@ -86,7 +86,7 @@ function parseConfigFile(program) {
if (action) {
options[key] = action(value);
}
})
});
console.log(`Configuration loaded from ${jsonPath}`)
}
return options;
@@ -94,11 +94,11 @@ function parseConfigFile(program) {
Command.prototype.setValuesIfNeeded = function(options) {
Object.keys(options).forEach((key) => {
if (!this[key]) {
if (!this.hasOwnProperty(key)) {
this[key] = options[key];
}
});
}
};
Command.prototype._parse = Command.prototype.parse;
@@ -113,7 +113,7 @@ Command.prototype.parse = function(args, env) {
this.setValuesIfNeeded(fromFile);
// Last set the defaults
this.setValuesIfNeeded(_defaults);
}
};
Command.prototype.getOptions = function() {
return Object.keys(_definitions).reduce((options, key) => {
@@ -122,7 +122,7 @@ Command.prototype.getOptions = function() {
}
return options;
}, {});
}
};
export default new Command();
/* eslint-enable no-console */