<commit_before>var express = require('express');
global.request = require('request');
var pjson = require('./package.json');
var fs = require('fs');

try{
  global.config = require('./config/cloudboost');
}catch(e){
  //if this module is not found then,
  global.config = null;
}

global.mongoDisconnected = false;
global.elasticDisconnected = false;
global.winston = require('winston');
require('winston-loggly');

global.keys = require('./database-connect/keys.js')();

global.winston.add(global.winston.transports.Loggly, {
    token: global.keys.logToken,
    subdomain: "cloudboost",
    tags: ["NodeJS"],
    json:true
});

global.keyService = require('./database-connect/keyService.js');

global.q = require('q');
global.uuid=require('uuid');
var bodyParser = require('body-parser');
var cookies = require("cookies");
var session = require('express-session');
global.app = express();

var http = null;
var https = null;
try{
  if(fs.statSync('./config/cert.crt').isFile() && fs.statSync('./config/key.key').isFile() ){
    //use https
    console.log("Running on HTTPS protocol.");
    var httpsOptions = {
      key: fs.readFileSync('./config/key.key'),
      cert: fs.readFileSync('./config/cert.crt')
    };

    https = require('https').Server(httpsOptions, global.app);
  
  }
}catch(e){
  console.log("SSL Certificate not found or is invalid.");
  console.log(e);
  console.log("Switching ONLY to HTTP...");
}

http = require('http').createServer(global.app);

require('./database-connect/cors.js')(); //cors!
var io = require('socket.io')(http);
var multer = require('multer');
var Redis = require('ioredis');

var ioRedisAdapter = require('socket.io-redis');

global.sessionHelper = require('./helpers/session.js');
global.socketSessionHelper = require('./helpers/socketSession.js');
global.cloudBoostHelper = require('./helpers/cloudboost.js')();
global.aclHelper = require('./helpers/ACL.js');

//setting socket.io redis store.
global.mongoService = null;
global.customService = null;
global.userService = null;
global.appService = null;<commit_msg>Added Socket Support for HTTPS<commit_after>var express = require('express');
global.request = require('request');
var pjson = require('./package.json');
var fs = require('fs');

try{
  global.config = require('./config/cloudboost');
}catch(e){
  //if this module is not found then,
  global.config = null;
}

global.mongoDisconnected = false;
global.elasticDisconnected = false;
global.winston = require('winston');
require('winston-loggly');

global.keys = require('./database-connect/keys.js')();

global.winston.add(global.winston.transports.Loggly, {
    token: global.keys.logToken,
    subdomain: "cloudboost",
    tags: ["NodeJS"],
    json:true
});

global.keyService = require('./database-connect/keyService.js');

global.q = require('q');
global.uuid=require('uuid');
var bodyParser = require('body-parser');
var cookies = require("cookies");
var session = require('express-session');
global.app = express();

var http = null;
var https = null;
try{
  if(fs.statSync('./config/cert.crt').isFile() && fs.statSync('./config/key.key').isFile() ){
    //use https
    console.log("Running on HTTPS protocol.");
    var httpsOptions = {
      key: fs.readFileSync('./config/key.key'),
      cert: fs.readFileSync('./config/cert.crt')
    };

    https = require('https').Server(httpsOptions, global.app);
  
  }
}catch(e){
  console.log("SSL Certificate not found or is invalid.");
  console.log(e);
  console.log("Switching ONLY to HTTP...");
}

http = require('http').createServer(global.app);

require('./database-connect/cors.js')(); //cors!
var io = require('socket.io')();
io.attach(http);
if(https){
    io.attach(https);
}
var multer = require('multer');
var Redis = require('ioredis');

var ioRedisAdapter = require('socket.io-redis');

global.sessionHelper = require('./helpers/session.js');
global.socketSessionHelper = require('./helpers/socketSession.js');
global.cloudBoostHelper = require('./helpers/cloudboost.js')();
global.aclHelper = require('./helpers/ACL.js');

//setting socket.io redis store.
global.mongoService = null;
global.customService = null;
global.userService = null;
global.appService = null;
{'fraction_non_alphanumeric': 0.18584703359542531, 'fraction_numerical': 0.0, 'mean_word_length': 4.634899328859061, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1134166', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1317, 'n_words': 266}