<commit_before>Q         = require 'kew'
nodeRedis = require 'redis'
mysql     = require 'mysql'
config    = require '../config'

connect =

  ready: Q.defer()

  ###
   * - type (string) : 'production', 'development', 'testing'
  ###

  init: () ->

    # Connect to MySQL
    @mysql = mysql.createConnection config.mysql

    # Connect to Redis
    @redis = nodeRedis.createClient config.redis.port, config.redis.host

    @ready.resolve()

module.exports = connect<commit_msg>Add support for Heroku Redis-To-Go<commit_after>Q      = require 'kew'
url    = require 'url'
redis  = require 'redis'
mysql  = require 'mysql'
config = require '../config'

connect =

  ready: Q.defer()

  ###
   * - type (string) : 'production', 'development', 'testing'
  ###

  init: () ->

    # Connect to MySQL
    @mysql = mysql.createConnection config.mysql

    # Connect to Redis
    if process.env.REDISTOGO_URL
      rtg = url.parse(process.env.REDISTOGO_URL);
      console.log rtg
      @redis = redis.createClient(rtg.port, rtg.hostname)
      @redis.auth rtg.auth.split(':')[1]
    else
      @redis = redis.createClient config.redis.port, config.redis.host

    @ready.resolve()

module.exports = connect
{'fraction_non_alphanumeric': 0.1398834304746045, 'fraction_numerical': 0.0008326394671107411, 'mean_word_length': 2.8774193548387097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5299555', 'n_tokens_mistral': 413, 'n_tokens_neox': 397, 'n_words': 92}