<commit_before>zlib                  = require 'compress-buffer'
traverse              = require 'traverse'
log                   = console.log
fs                    = require 'fs'

Configuration = (options={}) ->

  cloudamqp           = "golden-ox.rmq.cloudamqp.com"

  publicPort          = options.publicPort     = "80"
  hostname            = options.hostname       = "koding.com#{if options.publicPort is "80" then "" else ":"+publicPort}"
  protocol            = options.protocol      or "https:"
  publicHostname      = options.publicHostname = "https://#{options.hostname}"
  region              = "aws"
  configName          = "prod"
  environment         = "production"
  projectRoot         = options.projectRoot    or "/opt/koding"
  version             = options.tag
  tag                 = options.tag
  publicIP            = options.publicIP       or "*"
  githubuser          = options.githubuser     or "koding"

  mongo               = "dev:<EMAIL>:15184/koding"
  etcd                = "10.0.0.172:4001"

  redis               = { host:     "prod0.1ia3pb.0001.use1.cache.amazonaws.com"     , port:               "6379"                                , db:              0                    }
  redis.url           = "#{redis.host}:#{redis.port}"

  rabbitmq            = { host:     "#{cloudamqp}"                                   , port:               5672                                  , apiPort:         15672                  , login:           "hcaxnooc"                           , password: "<PASSWORD>"  , vhost: "hcaxnooc" }
  mq                  = { host:     "#{rabbitmq.host}"                               , port:               rabbitmq.port                         , apiAddress:      "#{rabbitmq.host}"     , apiPort:         "#{rabbitmq.apiPort}"                , login:    "#{rabbitmq.login}"    , componentUser: "#{rabbitmq.login}"                                   , password:       "#{<PASSWORD>}"                                , heartbeat:       0           , vhost:        "#{rabbitmq.vhost}" }
  customDomain        = { public:   "https://#{hostname}"                            , public_:            "#{hostname}"                         , local:           "http://127.0.0.1"     , local_:          "127.0.0.1"                          , port:     80                   }
  sendgrid            = { username: "koding"                                         , password:           "<PASSWORD>"                          }
  email               = { host:     "#{customDomain.public_}"                        , defaultFromMail:    '<EMAIL>'                    , defaultFromName: 'Koding'               , username:        sendgrid.username                    , password: <PASSWORD>    }
  kontrol             = { url:      "#{options.publicHostname}/kontrol/kite"         , port:               3000                                  , useTLS:          no                     , certFile:        ""                                   , keyFile:  ""                     , publicKeyFile: "#{projectRoot}/certs/test_kontrol_rsa_public.pem"    , privateKeyFile: "#{projectRoot}/certs/test_kontrol_rsa_private.pem"}
  broker              = { name:     "broker"                                         , serviceGenericName: "broker"                              , ip:              ""                     , webProtocol:     "https:"                             , host:     customDomain.public    , port:          8008                                                  , certFile:       ""                                                    , keyFile:         ""          , authExchange: "auth"                , authAllExchange: "authAll" , failoverUri: customDomain.public }
  regions             = { kodingme: "#{configName}"                                  , vagrant:            "vagrant"                             , sj:              "sj"                   , aws:             "aws"                                , premium:  "vagrant"            }
  algolia             = { appId:    'DYVV81J2S1'                                     , indexSuffix:     '.prod'                                }
  algoliaSecret       = { appId:    algolia.appId                                    , apiKey:             '<KEY>'    , indexSuffix:     algolia.indexSuffix    , apiSecretKey:    '<KEY>', apiTokenKey: "d15cab2a1bcead494e38cc33d32c4621" }
  mixpanel            = { token:    "3d7775525241b3350e6d89bd40031862"               , enabled:            yes                                 }
  postgres            = { host:     "prod0.cfbuweg6pdxe.us-east-1.rds.amazonaws.com" , port:               "5432"                                , username:        "socialapplication"    , password:        "<PASSWORD>"                  , dbname:   "social"             }
  kontrolPostgres     = { host:     "prod0.cfbuweg6pdxe.us-east-1.rds.amazonaws.com" , port:               5432                                  , username:        "kontrolapplication"   , password:        "<PASSWORD>"                 , dbname:   "social"             }
  kiteHome            = "#{projectRoot}/kite_home/koding"
  pubnub              = { publishkey: "pub-c-ed2a8027-1f8a-4070-b0ec-d4ad535435f6"   , subscribekey: "sub-c-00d2be66-8867-11e4-9b60-02ee2ddab7fe", secretkey: "<KEY>"                                     , serverAuthKey: "689b3039-439e-4ca6-80c2-3b0b17e3f2f3b3736a37-554c-44a1-86d4-45099a98c11a"       , origin: "pubsub.pubnub.com"                                           , enabled:  yes                         }
  gatekeeper          = { host:       "localhost"                                    , port:               "7200"                                , pubnub: pubnub                                }
  paymentwebhook      = { port : "6600", debug : true }
  tokbox              = { apiKey: '45082272', apiSecret: 'fb232a623fa9936ace8d8f9826c3e4a942d457b8' }


  kloudPort           = 5500
  kloud               = { port : kloudPort, privateKeyFile : kontrol.privateKeyFile , publicKeyFile: kontrol.publicKeyFile, kontrolUrl: kontrol.url, registerUrl : "#{customDomain.public}/kloud/kite", secretKey :  "<KEY>", address : "http://localhost:#{kloudPort}/kite"}

  googleapiServiceAccount = {clientId       :  "753589381435-irpve47dabrj9sjiqqdo2k9tr8l1jn5v.apps.googleusercontent.com", clientSecret : "<KEY>" , serviceAccountEmail    : "<EMAIL>", serviceAccountKeyFile : "#{projectRoot}/keys/googleapi-privatekey.pem"}

  # configuration for socialapi, order will be the same with
  # ./go/src/socialapi/config/configtypes.go<commit_msg>paymentwebook: turn on debug logs in prod<commit_after>zlib                  = require 'compress-buffer'
traverse              = require 'traverse'
log                   = console.log
fs                    = require 'fs'

Configuration = (options={}) ->

  cloudamqp           = "golden-ox.rmq.cloudamqp.com"

  publicPort          = options.publicPort     = "80"
  hostname            = options.hostname       = "koding.com#{if options.publicPort is "80" then "" else ":"+publicPort}"
  protocol            = options.protocol      or "https:"
  publicHostname      = options.publicHostname = "https://#{options.hostname}"
  region              = "aws"
  configName          = "prod"
  environment         = "production"
  projectRoot         = options.projectRoot    or "/opt/koding"
  version             = options.tag
  tag                 = options.tag
  publicIP            = options.publicIP       or "*"
  githubuser          = options.githubuser     or "koding"

  mongo               = "dev:<EMAIL>:15184/koding"
  etcd                = "10.0.0.172:4001"

  redis               = { host:     "prod0.1ia3pb.0001.use1.cache.amazonaws.com"     , port:               "6379"                                , db:              0                    }
  redis.url           = "#{redis.host}:#{redis.port}"

  rabbitmq            = { host:     "#{cloudamqp}"                                   , port:               5672                                  , apiPort:         15672                  , login:           "hcaxnooc"                           , password: "<PASSWORD>"  , vhost: "hcaxnooc" }
  mq                  = { host:     "#{rabbitmq.host}"                               , port:               rabbitmq.port                         , apiAddress:      "#{rabbitmq.host}"     , apiPort:         "#{rabbitmq.apiPort}"                , login:    "#{rabbitmq.login}"    , componentUser: "#{rabbitmq.login}"                                   , password:       "#{rabbitmq.password}"                                , heartbeat:       0           , vhost:        "#{rabbitmq.vhost}" }
  customDomain        = { public:   "https://#{hostname}"                            , public_:            "#{hostname}"                         , local:           "http://127.0.0.1"     , local_:          "127.0.0.1"                          , port:     80                   }
  sendgrid            = { username: "koding"                                         , password:           "DEQl7_Dr"                          }
  email               = { host:     "#{customDomain.public_}"                        , defaultFromMail:    '<EMAIL>'                    , defaultFromName: 'Koding'               , username:        sendgrid.username                    , password: <PASSWORD>    }
  kontrol             = { url:      "#{options.publicHostname}/kontrol/kite"         , port:               3000                                  , useTLS:          no                     , certFile:        ""                                   , keyFile:  ""                     , publicKeyFile: "#{projectRoot}/certs/test_kontrol_rsa_public.pem"    , privateKeyFile: "#{projectRoot}/certs/test_kontrol_rsa_private.pem"}
  broker              = { name:     "broker"                                         , serviceGenericName: "broker"                              , ip:              ""                     , webProtocol:     "https:"                             , host:     customDomain.public    , port:          8008                                                  , certFile:       ""                                                    , keyFile:         ""          , authExchange: "auth"                , authAllExchange: "authAll" , failoverUri: customDomain.public }
  regions             = { kodingme: "#{configName}"                                  , vagrant:            "vagrant"                             , sj:              "sj"                   , aws:             "aws"                                , premium:  "vagrant"            }
  algolia             = { appId:    'DYVV81J2S1'                                     , indexSuffix:     '.prod'                                }
  algoliaSecret       = { appId:    algolia.appId                                    , apiKey:             '<KEY>'    , indexSuffix:     algolia.indexSuffix    , apiSecretKey:    '<KEY>', apiTokenKey: "d15cab2a1bcead494e38cc33d32c4621" }
  mixpanel            = { token:    "3d7775525241b3350e6d89bd40031862"               , enabled:            yes                                 }
  postgres            = { host:     "prod0.cfbuweg6pdxe.us-east-1.rds.amazonaws.com" , port:               "5432"                                , username:        "socialapplication"    , password:        "<PASSWORD>"                  , dbname:   "social"             }
  kontrolPostgres     = { host:     "prod0.cfbuweg6pdxe.us-east-1.rds.amazonaws.com" , port:               5432                                  , username:        "kontrolapplication"   , password:        "<PASSWORD>"                 , dbname:   "social"             }
  kiteHome            = "#{projectRoot}/kite_home/koding"
  pubnub              = { publishkey: "pub-c-ed2a8027-1f8a-4070-b0ec-d4ad535435f6"   , subscribekey: "sub-c-00d2be66-8867-11e4-9b60-02ee2ddab7fe", secretkey: "<KEY>"                                     , serverAuthKey: "689b3039-439e-4ca6-80c2-3b0b17e3f2f3b3736a37-554c-44a1-86d4-45099a98c11a"       , origin: "pubsub.pubnub.com"                                           , enabled:  yes                         }
  gatekeeper          = { host:       "localhost"                                    , port:               "7200"                                , pubnub: pubnub                                }
  paymentwebhook      = { port : "6600", debug : false }
  tokbox              = { apiKey: '45082272', apiSecret: 'fb232a623fa9936ace8d8f9826c3e4a942d457b8' }


  kloudPort           = 5500
  kloud               = { port : kloudPort, privateKeyFile : kontrol.privateKeyFile , publicKeyFile: kontrol.publicKeyFile, kontrolUrl: kontrol.url, registerUrl : "#{customDomain.public}/kloud/kite", secretKey :  "<KEY>", address : "http://localhost:#{kloudPort}/kite"}

  googleapiServiceAccount = {clientId       :  "753589381435-irpve47dabrj9sjiqqdo2k9tr8l1jn5v.apps.googleusercontent.com", clientSecret : "<KEY>" , serviceAccountEmail    : "753589381435-irpve47dabrj9sjiqqdo2k9tr8l1jn5v@developer.<EMAIL>", serviceAccountKeyFile : "#{projectRoot}/keys/googleapi-privatekey.pem"}

  # configuration for socialapi, order will be the same with
  # ./go/src/socialapi/config/configtypes.go
{'fraction_non_alphanumeric': 0.10588146127027437, 'fraction_numerical': 0.04342883128694861, 'mean_word_length': 1.0997772119669, 'pattern_counts': {'":': 2, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 84, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1644819', 'n_tokens_mistral': 3901, 'n_tokens_neox': 3567, 'n_words': 569}