<commit_before>module.exports = function(server) {
  var fs  = require('fs')
    , mongoose  = require('mongoose')
    , options   = { autoReconnect: true }
    , mongodb   = server.config.mongodb
    , auth = ''
    , db
    ;

  /**
   * Set up mongodb.
   */
  if(mongodb.user)
    auth = mongodb.user+":"+mongodb.pass+"@";

  var mongourl = process.env.MONGOLAB_URI ||
    process.env.MONGOHQ_URL ||
    'mongodb://' + auth + mongodb.host + ':' + (mongodb.port || 27017) + '/' + mongodb.database;

  db = mongoose.createConnection(mongourl, options, function (err, db2) {
    if (err) console.error('MONGODB : ', err.message);
  });
  var eventHandler = db.db;

  eventHandler.on('open', function(err) {
    console.log('Mongoose connected.');
  });
  eventHandler.on('error', function(err) {
    console.error('MONGODB : ', err);
  });

  server.set('db', db);


  /**
   * Models.
   */
  server.mongoose = require('mongoose');

  var ms = {};
  var models = [
    'Game',
  ];<commit_msg>Fix mongodb uri from heroku<commit_after>module.exports = function(server) {
  var fs  = require('fs')
    , mongoose  = require('mongoose')
    , options   = { autoReconnect: true }
    , mongodb   = server.config.mongodb
    , auth = ''
    , db
    ;

  /**
   * Set up mongodb.
   */
  if(mongodb.user)
    auth = mongodb.user+":"+mongodb.pass+"@";

  var mongourl = process.env.MONGODB_URI ||
    'mongodb://' + auth + mongodb.host + ':' + (mongodb.port || 27017) + '/' + mongodb.database;

  db = mongoose.createConnection(mongourl, options, function (err, db2) {
    if (err) console.error('MONGODB : ', err.message);
  });
  var eventHandler = db.db;

  eventHandler.on('open', function(err) {
    console.log('Mongoose connected.');
  });
  eventHandler.on('error', function(err) {
    console.error('MONGODB : ', err);
  });

  server.set('db', db);


  /**
   * Models.
   */
  server.mongoose = require('mongoose');

  var ms = {};
  var models = [
    'Game',
  ];
{'fraction_non_alphanumeric': 0.18661257606490872, 'fraction_numerical': 0.006085192697768763, 'mean_word_length': 2.8460038986354776, 'pattern_counts': {'":': 2, '<': 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': '2533704', 'n_tokens_mistral': 752, 'n_tokens_neox': 715, 'n_words': 125}