<commit_before>/**
 * Monitor remote service
 *
 */
var http = require('http'),
    url = require('url')
    express = require('express'),
    config = require('config');

var mongoose = require('./bootstrap');

var app = express(),
    server = http.createServer(app);

// Bootstrap application settings
require('./config/express')(app, config);

// Bootstrap socket.io settings
require('./config/io')(server, config);

if(!module.parent) {
  var serverUrl = url.parse(config.url);
  var port = serverUrl.port;
  if(port === null) {
    port = 80;
  }

  var host = serverUrl.hostname;
  server.listen(port, function() {
    console.log('Express server listening on host %s, port %d', host, port);
  });
  server.on('error', function() {
  });
}

// Expose
module.exports = app;<commit_msg>enable auto start monitor...<commit_after>/**
 * Monitor remote service
 *
 */
var http = require('http'),
    url = require('url')
    express = require('express'),
    config = require('config'),
    monitor = require('./lib/monitor');

var mongoose = require('./bootstrap');

var app = express(),
    server = http.createServer(app);

// Bootstrap application settings
require('./config/express')(app, config);

// Bootstrap socket.io settings
require('./config/io')(server, config);

// Expose
module.exports = app;

var monitorInstance;

if(!module.parent) {
  var serverUrl = url.parse(config.url);
  var port = serverUrl.port;
  if(port === null) {
    port = 80;
  }

  var host = serverUrl.hostname;
  server.listen(port, function() {
    console.log('Express server listening on host %s, port %d', host, port);
  });
  server.on('error', function() {
      if(monitorInstance) {
          monitorInstance.stop();
          process.exit(1);
      }
  });
}

if(config.autoStartMonitor){
    monitorInstance = require('./monitor');
}
{'fraction_non_alphanumeric': 0.17358078602620086, 'fraction_numerical': 0.0027292576419213972, 'mean_word_length': 3.5147783251231526, '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': '1897932', 'n_tokens_mistral': 560, 'n_tokens_neox': 552, 'n_words': 136}