lib/util/appUtil.js
function(app, args) {
  let serverType = args.serverType || Constants.RESERVED.MASTER;
  let serverId = args.id || app.getMaster().id;
  let mode = args.mode || Constants.RESERVED.CLUSTER;
  let masterha = args.masterha || 'false';
  let type = args.type || Constants.RESERVED.ALL;
  let startId = args.startId;

  app.set(Constants.RESERVED.MAIN, args.main, true);
  app.set(Constants.RESERVED.SERVER_TYPE, serverType, true);
  app.set(Constants.RESERVED.SERVER_ID, serverId, true);
  app.set(Constants.RESERVED.MODE, mode, true);
  app.set(Constants.RESERVED.TYPE, type, true);
  if(!!startId) {
    app.set(Constants.RESERVED.STARTID, startId, true);
  }

  if (masterha === 'true') {
    app.master = args;
    app.set(Constants.RESERVED.CURRENT_SERVER, args, true);
  } else if (serverType !== Constants.RESERVED.MASTER) {
    app.set(Constants.RESERVED.CURRENT_SERVER, args, true);
  } else {
    app.set(Constants.RESERVED.CURRENT_SERVER, app.getMaster(), true);
  }
}
function(app, args) {
  let serverType = args.serverType || Constants.RESERVED.MASTER;
  let serverId = args.id || app.getMaster().id;
  let mode = args.mode || Constants.RESERVED.CLUSTER;
  let masterha = args.masterha || 'false';
  let type = args.type || Constants.RESERVED.ALL;
  let startId = args.startId;

  app.set(Constants.RESERVED.MAIN, args.main, true);
  app.set(Constants.RESERVED.SERVER_TYPE, serverType, true);
  app.set(Constants.RESERVED.SERVER_ID, serverId, true);
  app.set(Constants.RESERVED.MODE, mode, true);
  app.set(Constants.RESERVED.TYPE, type, true);
  if(!!startId) {
    app.set(Constants.RESERVED.STARTID, startId, true);
  }

  if (masterha === 'true') {
    app.master = args;
    app.set(Constants.RESERVED.CURRENT_SERVER, args, true);
  } else if (serverType !== Constants.RESERVED.MASTER) {
    app.set(Constants.RESERVED.CURRENT_SERVER, args, true);
  } else {
    app.set(Constants.RESERVED.CURRENT_SERVER, app.getMaster(), true);
  }
}
function ( app , args ) { let serverType = args . serverType || Constants . RESERVED . MASTER ; let serverId = args . id || app . getMaster ( ) . id ; let mode = args . mode || Constants . RESERVED . CLUSTER ; let masterha = args . masterha || 'false' ; let type = args . type || Constants . RESERVED . ALL ; let startId = args . startId ; app . set ( Constants . RESERVED . MAIN , args . main , true ) ; app . set ( Constants . RESERVED . SERVER_TYPE , serverType , true ) ; app . set ( Constants . RESERVED . SERVER_ID , serverId , true ) ; app . set ( Constants . RESERVED . MODE , mode , true ) ; app . set ( Constants . RESERVED . TYPE , type , true ) ; if ( ! ! startId ) { app . set ( Constants . RESERVED . STARTID , startId , true ) ; } if ( masterha === 'true' ) { app . master = args ; app . set ( Constants . RESERVED . CURRENT_SERVER , args , true ) ; } else if ( serverType !== Constants . RESERVED . MASTER ) { app . set ( Constants . RESERVED . CURRENT_SERVER , args , true ) ; } else { app . set ( Constants . RESERVED . CURRENT_SERVER , app . getMaster ( ) , true ) ; } }
Process server start command
Process server start command