Skip to content

Commit

Permalink
Update global to lower case (#1039)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Sep 22, 2017
1 parent b70d0db commit b4b1e8b
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 206 deletions.
18 changes: 9 additions & 9 deletions erizo_controller/common/amqper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ var logger = require('./logger').logger;
var log = logger.getLogger('AMQPER');

// Configuration default values
GLOBAL.config.rabbit = GLOBAL.config.rabbit || {};
GLOBAL.config.rabbit.host = GLOBAL.config.rabbit.host || 'localhost';
GLOBAL.config.rabbit.port = GLOBAL.config.rabbit.port || 5672;
global.config.rabbit = global.config.rabbit || {};
global.config.rabbit.host = global.config.rabbit.host || 'localhost';
global.config.rabbit.port = global.config.rabbit.port || 5672;

var TIMEOUT = 5000;

Expand All @@ -22,15 +22,15 @@ var connection, rpcExc, broadcastExc, clientQueue;
var addr = {};
var rpcPublic = {};

if (GLOBAL.config.rabbit.url !== undefined) {
addr.url = GLOBAL.config.rabbit.url;
if (global.config.rabbit.url !== undefined) {
addr.url = global.config.rabbit.url;
} else {
addr.host = GLOBAL.config.rabbit.host;
addr.port = GLOBAL.config.rabbit.port;
addr.host = global.config.rabbit.host;
addr.port = global.config.rabbit.port;
}

if(GLOBAL.config.rabbit.heartbeat !==undefined){
addr.heartbeat = GLOBAL.config.rabbit.heartbeat;
if(global.config.rabbit.heartbeat !==undefined){
addr.heartbeat = global.config.rabbit.heartbeat;
}

exports.setPublicRPC = function(methods) {
Expand Down
4 changes: 2 additions & 2 deletions erizo_controller/common/logger.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
var log4js = require('log4js');

GLOBAL.config.logger = GLOBAL.config.logger || {};
global.config.logger = global.config.logger || {};

var logFile = GLOBAL.config.logger.configFile || '../log4js_configuration.json';
var logFile = global.config.logger.configFile || '../log4js_configuration.json';


var logJsonReplacer = function (key, value){
Expand Down
78 changes: 39 additions & 39 deletions erizo_controller/erizoAgent/erizoAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ var spawn = require('child_process').spawn;
var config = require('./../../licode_config');

// Configuration default values
GLOBAL.config = config || {};
GLOBAL.config.erizoAgent = GLOBAL.config.erizoAgent || {};
GLOBAL.config.erizoAgent.maxProcesses = GLOBAL.config.erizoAgent.maxProcesses || 1;
GLOBAL.config.erizoAgent.prerunProcesses =
GLOBAL.config.erizoAgent.prerunProcesses === undefined ?
1 : GLOBAL.config.erizoAgent.prerunProcesses;
GLOBAL.config.erizoAgent.publicIP = GLOBAL.config.erizoAgent.publicIP || '';
GLOBAL.config.erizoAgent.instanceLogDir = GLOBAL.config.erizoAgent.instanceLogDir || '.';
GLOBAL.config.erizoAgent.useIndividualLogFiles =
GLOBAL.config.erizoAgent.useIndividualLogFiles|| false;

GLOBAL.config.erizoAgent.launchDebugErizoJS = GLOBAL.config.erizoAgent.launchDebugErizoJS || false;

var BINDED_INTERFACE_NAME = GLOBAL.config.erizoAgent.networkInterface;
global.config = config || {};
global.config.erizoAgent = global.config.erizoAgent || {};
global.config.erizoAgent.maxProcesses = global.config.erizoAgent.maxProcesses || 1;
global.config.erizoAgent.prerunProcesses =
global.config.erizoAgent.prerunProcesses === undefined ?
1 : global.config.erizoAgent.prerunProcesses;
global.config.erizoAgent.publicIP = global.config.erizoAgent.publicIP || '';
global.config.erizoAgent.instanceLogDir = global.config.erizoAgent.instanceLogDir || '.';
global.config.erizoAgent.useIndividualLogFiles =
global.config.erizoAgent.useIndividualLogFiles|| false;

global.config.erizoAgent.launchDebugErizoJS = global.config.erizoAgent.launchDebugErizoJS || false;

var BINDED_INTERFACE_NAME = global.config.erizoAgent.networkInterface;
const LAUNCH_SCRIPT = './launch.sh';

// Parse command line arguments
Expand Down Expand Up @@ -58,37 +58,37 @@ for (var prop in opt.options) {
process.exit(0);
break;
case 'rabbit-host':
GLOBAL.config.rabbit = GLOBAL.config.rabbit || {};
GLOBAL.config.rabbit.host = value;
global.config.rabbit = global.config.rabbit || {};
global.config.rabbit.host = value;
break;
case 'rabbit-port':
GLOBAL.config.rabbit = GLOBAL.config.rabbit || {};
GLOBAL.config.rabbit.port = value;
global.config.rabbit = global.config.rabbit || {};
global.config.rabbit.port = value;
break;
case 'rabbit-heartbeat':
GLOBAL.config.rabbit = GLOBAL.config.rabbit || {};
GLOBAL.config.rabbit.heartbeat = value;
global.config.rabbit = global.config.rabbit || {};
global.config.rabbit.heartbeat = value;
break;
case 'max-processes':
GLOBAL.config.erizoAgent = GLOBAL.config.erizoAgent || {};
GLOBAL.config.erizoAgent.maxProcesses = value;
global.config.erizoAgent = global.config.erizoAgent || {};
global.config.erizoAgent.maxProcesses = value;
break;
case 'prerun-processes':
GLOBAL.config.erizoAgent = GLOBAL.config.erizoAgent || {};
GLOBAL.config.erizoAgent.prerunProcesses = value;
global.config.erizoAgent = global.config.erizoAgent || {};
global.config.erizoAgent.prerunProcesses = value;
break;
case 'individual-logs':
GLOBAL.config.erizoAgent = GLOBAL.config.erizoAgent || {};
GLOBAL.config.erizoAgent.useIndividualLogFiles = true;
global.config.erizoAgent = global.config.erizoAgent || {};
global.config.erizoAgent.useIndividualLogFiles = true;
break;
case 'metadata':
metadata = JSON.parse(value);
break;
case 'debug':
GLOBAL.config.erizoAgent.launchDebugErizoJS = true;
global.config.erizoAgent.launchDebugErizoJS = true;
break;
default:
GLOBAL.config.erizoAgent[prop] = value;
global.config.erizoAgent[prop] = value;
break;
}
}
Expand Down Expand Up @@ -123,8 +123,8 @@ var myErizoAgentId = guid();
var launchErizoJS;

var fillErizos = function () {
if (erizos.length + idleErizos.length < GLOBAL.config.erizoAgent.maxProcesses) {
if (idleErizos.length < GLOBAL.config.erizoAgent.prerunProcesses) {
if (erizos.length + idleErizos.length < global.config.erizoAgent.maxProcesses) {
if (idleErizos.length < global.config.erizoAgent.prerunProcesses) {
launchErizoJS();
fillErizos();
}
Expand All @@ -137,13 +137,13 @@ launchErizoJS = function() {
var fs = require('fs');
var erizoProcess, out, err;
const erizoLaunchOptions = ['./../erizoJS/erizoJS.js', id, privateIP, publicIP];
if (GLOBAL.config.erizoAgent.launchDebugErizoJS) {
if (global.config.erizoAgent.launchDebugErizoJS) {
erizoLaunchOptions.push('-d');
}

if (GLOBAL.config.erizoAgent.useIndividualLogFiles){
out = fs.openSync(GLOBAL.config.erizoAgent.instanceLogDir + '/erizo-' + id + '.log', 'a');
err = fs.openSync(GLOBAL.config.erizoAgent.instanceLogDir + '/erizo-' + id + '.log', 'a');
if (global.config.erizoAgent.useIndividualLogFiles){
out = fs.openSync(global.config.erizoAgent.instanceLogDir + '/erizo-' + id + '.log', 'a');
err = fs.openSync(global.config.erizoAgent.instanceLogDir + '/erizo-' + id + '.log', 'a');
erizoProcess = spawn(LAUNCH_SCRIPT, erizoLaunchOptions,
{ detached: true, stdio: [ 'ignore', out, err ] });
}else{
Expand Down Expand Up @@ -220,7 +220,7 @@ var getErizo = function () {
var erizoId = idleErizos.shift();

if (!erizoId) {
if (erizos.length < GLOBAL.config.erizoAgent.maxProcesses) {
if (erizos.length < global.config.erizoAgent.maxProcesses) {
launchErizoJS();
return getErizo();
} else {
Expand Down Expand Up @@ -261,8 +261,8 @@ var api = {

for (k in interfaces) {
if (interfaces.hasOwnProperty(k)) {
if (!GLOBAL.config.erizoAgent.networkinterface ||
GLOBAL.config.erizoAgent.networkinterface === k) {
if (!global.config.erizoAgent.networkinterface ||
global.config.erizoAgent.networkinterface === k) {
for (k2 in interfaces[k]) {
if (interfaces[k].hasOwnProperty(k2)) {
address = interfaces[k][k2];
Expand All @@ -279,7 +279,7 @@ for (k in interfaces) {

privateIP = addresses[0];

if (GLOBAL.config.erizoAgent.publicIP === '' || GLOBAL.config.erizoAgent.publicIP === undefined) {
if (global.config.erizoAgent.publicIP === '' || global.config.erizoAgent.publicIP === undefined) {
publicIP = addresses[0];

if (global.config.cloudProvider.name === 'amazon') {
Expand All @@ -301,7 +301,7 @@ if (GLOBAL.config.erizoAgent.publicIP === '' || GLOBAL.config.erizoAgent.publicI
fillErizos();
}
} else {
publicIP = GLOBAL.config.erizoAgent.publicIP;
publicIP = global.config.erizoAgent.publicIP;
fillErizos();
}

Expand Down
4 changes: 2 additions & 2 deletions erizo_controller/erizoController/ecCloudHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ exports.EcCloudHandler = function (spec) {

var getErizoAgent;

if (GLOBAL.config.erizoController.cloudHandlerPolicy) {
if (global.config.erizoController.cloudHandlerPolicy) {
getErizoAgent = require('./ch_policies/' +
GLOBAL.config.erizoController.cloudHandlerPolicy).getErizoAgent;
global.config.erizoController.cloudHandlerPolicy).getErizoAgent;
}

var tryAgain = function (count, agentId, callback) {
Expand Down
Loading

0 comments on commit b4b1e8b

Please sign in to comment.