<commit_before>/* jshint asi: true, node: true, laxbreak: true, laxcomma: true, undef: true, unused: true, esversion: 6 */

const services = {
  eyeshade: {
    portno: 3002,

    f: () => {
      module.exports.referrals =
        { currency              : process.env.REFERRALS_CURRENCY || 'USD'
        , amount                : process.env.REFERRALS_AMOUNT || 5
        }
      module.exports.postgres =
        { url                   : process.env.DATABASE_URL || 'postgres://localhost/test'
        , roURL                 : process.env.DATABASE_RO_URL || false
        , schemaVersion         : require('./eyeshade/migrations/current')
        , schemaVersionCheck    : true
        }

      uphold()
    }
  }
}

const uphold = () => {
  if ((!process.env.UPHOLD_ACCESS_TOKEN) && (!process.env.UPHOLD_CLIENT_ID)) return

  module.exports.wallet.uphold =
  { accessToken       : process.env.UPHOLD_ACCESS_TOKEN         || 'none'
  , clientId          : process.env.UPHOLD_CLIENT_ID            || 'none'
  , clientSecret      : process.env.UPHOLD_CLIENT_SECRET        || 'none'
  , environment       : process.env.UPHOLD_ENVIRONMENT          || 'sandbox'
  }
}


const service = services[process.env.SERVICE]
if (!service) {
  throw new Error('invalid process.env.SERVICE=' + process.env.SERVICE)
}

process.env.PORT = process.env.PORT  || service.portno
let redisURL = process.env.REDIS_URL
const redisPass = process.env.REDIS_PASSWORD
if (redisPass) {
  redisURL = `redis://user:${encodeURIComponent(redisPass)}@${process.env.REDIS_MASTER_SERVICE_HOST_REDIS}:${process.env.REDIS_MASTER_SERVICE_PORT_REDIS}`
}

module.exports =
{
  altcurrency           : process.env.ALTCURRENCY               || 'BAT'
, cache                 :
  { redis               :
    { url               : redisURL                 || 'redis://localhost:6379' }
  }
, currency              :
  { altcoins            : process.env.CRYPTO_CURRENCIES ? process.env.CRYPTO_CURRENCIES.split(',')
                                                        : [ 'BAT', 'BTC', 'ETH', 'LTC' ] }
, login                 : { github: false }
, sentry                :
  { dsn: process.env.SENTRY_DSN          || false
  , slug: process.env.HEROKU_SLUG_COMMIT || 'test'
  , project: process.env.HEROKU_APP_NAME  || process.env.SERVICE
  }
, newrelic              : { key: process.env.NEW_RELIC_LICENSE_KEY
                                                                || false }
, wallet                : { }
, testingCohorts        : process.env.TESTING_COHORTS ? process.env.TESTING_COHORTS.split(',') : []
, currency:
  { url: process.env.BAT_RATIOS_URL || false
  , access_token: process.env.BAT_RATIOS_TOKEN || false<commit_msg>removed redis url logic (#991)<commit_after>/* jshint asi: true, node: true, laxbreak: true, laxcomma: true, undef: true, unused: true, esversion: 6 */

const services = {
  eyeshade: {
    portno: 3002,

    f: () => {
      module.exports.referrals =
        { currency              : process.env.REFERRALS_CURRENCY || 'USD'
        , amount                : process.env.REFERRALS_AMOUNT || 5
        }
      module.exports.postgres =
        { url                   : process.env.DATABASE_URL || 'postgres://localhost/test'
        , roURL                 : process.env.DATABASE_RO_URL || false
        , schemaVersion         : require('./eyeshade/migrations/current')
        , schemaVersionCheck    : true
        }

      uphold()
    }
  }
}

const uphold = () => {
  if ((!process.env.UPHOLD_ACCESS_TOKEN) && (!process.env.UPHOLD_CLIENT_ID)) return

  module.exports.wallet.uphold =
  { accessToken       : process.env.UPHOLD_ACCESS_TOKEN         || 'none'
  , clientId          : process.env.UPHOLD_CLIENT_ID            || 'none'
  , clientSecret      : process.env.UPHOLD_CLIENT_SECRET        || 'none'
  , environment       : process.env.UPHOLD_ENVIRONMENT          || 'sandbox'
  }
}


const service = services[process.env.SERVICE]
if (!service) {
  throw new Error('invalid process.env.SERVICE=' + process.env.SERVICE)
}

process.env.PORT = process.env.PORT  || service.portno
let redisURL = process.env.REDIS_URL

module.exports =
{
  altcurrency           : process.env.ALTCURRENCY               || 'BAT'
, cache                 :
  { redis               :
    { url               : redisURL                 || 'redis://localhost:6379' }
  }
, currency              :
  { altcoins            : process.env.CRYPTO_CURRENCIES ? process.env.CRYPTO_CURRENCIES.split(',')
                                                        : [ 'BAT', 'BTC', 'ETH', 'LTC' ] }
, login                 : { github: false }
, sentry                :
  { dsn: process.env.SENTRY_DSN          || false
  , slug: process.env.HEROKU_SLUG_COMMIT || 'test'
  , project: process.env.HEROKU_APP_NAME  || process.env.SERVICE
  }
, newrelic              : { key: process.env.NEW_RELIC_LICENSE_KEY
                                                                || false }
, wallet                : { }
, testingCohorts        : process.env.TESTING_COHORTS ? process.env.TESTING_COHORTS.split(',') : []
, currency:
  { url: process.env.BAT_RATIOS_URL || false
  , access_token: process.env.BAT_RATIOS_TOKEN || false
{'fraction_non_alphanumeric': 0.12466333205078876, 'fraction_numerical': 0.004424778761061947, 'mean_word_length': 1.8628854625550662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2292392', 'n_tokens_mistral': 1700, 'n_tokens_neox': 1665, 'n_words': 252}