<commit_before>traverse              = require 'traverse'
log                   = console.log
fs                    = require 'fs'
os                    = require 'os'
path                  = require 'path'
{ isAllowed }         = require '../deployment/grouptoenvmapping'

Configuration = (options={}) ->

  defaultEmail =

  boot2dockerbox = if os.type() is "Darwin" then "192.168.59.103" else "localhost"

  # Softlayer Provider Keys
  slKeys       =
    vm_kloud   :
      username : ''
      apiKey   : ''

  # AWS Keys that is required for Kloud
  awsKeys =
    # s3 full access
    worker_terraformer:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # s3 put only to koding-client bucket
    worker_koding_client_s3_put_only:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # admin
    worker_test:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # s3 put only
    worker_test_data_exporter:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # AmazonRDSReadOnlyAccess
    worker_rds_log_parser:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # ELB & EC2 -> AmazonEC2ReadOnlyAccess
    worker_multi_ssh:
      accessKeyId     : "<KEY>"
      secretAccessKey : <KEY>"

    # AmazonEC2FullAccess
    worker_test_instance_launcher:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # CloudWatchReadOnlyAccess
    vm_vmwatcher:     # vm_vmwatcher_dev
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # KloudPolicy
    vm_kloud:         # vm_kloud_dev
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # TunnelProxyPolicy
    worker_tunnelproxymanager: # Name worker_tunnelproxymanager_dev
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # Encryption and Storage on S3
    worker_sneakerS3 :
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

  publicPort          = options.publicPort     or "8090"
  hostname            = options.hostname       or "dev.koding.com"
  protocol            = options.protocol       or "http:"
  publicHostname      = options.publicHostname or "#{protocol}//#{hostname}"
  region              = options.region         or 'default'
  configName          = options.configName     or 'default'
  environment         = options.environment    or 'default'
  projectRoot         = options.projectRoot    or path.join __dirname, '/..'
  version             = options.version        or "2.0" # TBD
  branch              = options.branch         or "cake-rewrite"
  build               = options.build          or "1111"
  tunnelUrl           = options.tunnelUrl      or "http://devtunnelproxy.koding.com" # this is ok for now
  githubapi           =
    debug             : yes
    timeout           : 5000
    userAgent         : 'Koding-Bridge-Dev'

  mongo               = "#{boot2dockerbox}:27017/koding"
  etcd                = "#{boot2dockerbox}:4001"

  redis               = { host:     "#{boot2dockerbox}"                           , port:               "6379"                                  , db:                 0                         }
  redis.url           = "#{redis.host}:#{redis.port}"

  rabbitmq            = { host:     "#{boot2dockerbox}"                           , port:               5672                                    , apiPort:            15672                       , login:           "guest"                              , password: "<PASSWORD>"                     , vhost:         "/"                                    }
  mq                  = { host:     "#{rabbitmq.host}"                            , port:               rabbitmq.port                           , apiAddress:         "#{rabbitmq.host}"          , apiPort:         "#{rabbitmq.apiPort}"                , login:    "#{rabbitmq.login}"         , componentUser: "#{rabbitmq.login}"                      , password:       "#{<PASSWORD>}"                   , heartbeat:       10           , vhost:        "#{rabbitmq.vhost}" }

  scheme = 'http'
  _port  = if publicPort is '80' then '' else publicPort
  host   = options.host or "#{options.hostname}:#{_port}"

  local = "127.0.0.1"
  if publicPort isnt '80'
    local = "#{local}:#{publicPort}"

  customDomain        = { public: "#{scheme}://#{host}", public_: host, local: "http://#{local}", local_: "#{local}", host: "http://#{hostname}", port: 8090 }

  email               = { host:     "#{customDomain.public_}"                     , defaultFromMail:    defaultEmail                            , defaultFromName:    'Koding'                    , forcedRecipientEmail: defaultEmail                    , forcedRecipientUsername: "admin" }
  kontrol             = { url:      "#{customDomain.public}/kontrol/kite"         , port:               3000                                    , useTLS:             no                          , certFile:        ""                                   , keyFile:  ""                          , publicKeyFile: "./certs/test_kontrol_rsa_public.pem"    , privateKeyFile: "./certs/test_kontrol_rsa_private.pem"}
  broker              = { name:     "broker"                                      , serviceGenericName: "broker"                                , ip:                 ""                          , webProtocol:     "http:"                              , 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:    ''                                            , indexSuffix:        ".#{ os.hostname() }"                   }
  algoliaSecret       = { appId:    "#{algolia.appId}"                            , indexSuffix:        algolia.indexSuffix                     , apiSecretKey:       ''                          , apiSearchOnlyKey: '' }
  postgres            = { host:     "#{boot2dockerbox}"                           , port:               "5432"                                  , username:           "socialapp201506"           , password:        "<PASSWORD>"                    , dbname:   "social"                  }
  kontrolPostgres     = { host:     "#{boot2dockerbox}"                           , port:               5432                                    , username:           "kontrolapp201506"          , password:        "<PASSWORD>"                   , dbname:   "social"                    , connecttimeout: 20 }
  kiteHome            = "#{projectRoot}/kite_home/koding"
  pubnub              = { publishkey: ""                                          , subscribekey:       ""                                      , secretkey: ""                                   , serverAuthKey: ""                                     , origin: "pubsub.pubnub.com"           , enabled: no }
  gatekeeper          = { host:     "localhost"                                   , port:               "7200"                                  , pubnub: pubnub                                }
  integration         = { host:     "localhost"                                   , port:               "7300"                                  , url: "#{customDomain.public}/api/integration" }
  webhookMiddleware   = { host:     "localhost"                                   , port:               "7350"                                  , url: "#{customDomain.public}/api/webhook"     }
  paymentwebhook      = { port:     "6600"                                        , debug:              false                                   , secretKey: "paymentwebhooksecretkey-dev"      }
  tokbox              = { apiKey:   ""                                            , apiSecret:          "" }
  recaptcha           = { enabled: no }

  # configuration for socialapi, order will be the same with
  # ./go/src/socialapi/config/configtypes.go

  kloudPort           = 5500
  kloud               = { port : kloudPort, userPrivateKeyFile: "./certs/kloud/dev/kloud_dev_rsa.pem",    userPublicKeyfile: "./certs/kloud/dev/kloud_dev_rsa.pub",  privateKeyFile : kontrol.privateKeyFile , publicKeyFile: kontrol.publicKeyFile, kontrolUrl: kontrol.url, registerUrl : "#{customDomain.public}/kloud/kite", secretKey :  "", address : "http://localhost:#{kloudPort}/kite", tunnelUrl : "#{tunnelUrl}"}
  terraformer         = { port : 2300     , bucket:             "koding-terraformer-state-dev", localstorepath: "#{projectRoot}/go/data/terraformer" }

  googleapiServiceAccount =
    clientId              : ''
    clientSecret          : ''
    serviceAccountEmail   : ''
    serviceAccountKeyFile : ''

  segment = ''

  github =
    clientId     : "f8e440b796d953ea01e5"
    clientSecret : "b72e2576926a5d67119d5b440107639c6499ed42"
    redirectUri  : "http://dev.koding.com:8090/-/oauth/github/callback"
<commit_msg>main.default: fix gatekeeper with the same creds from main.dev<commit_after>traverse              = require 'traverse'
log                   = console.log
fs                    = require 'fs'
os                    = require 'os'
path                  = require 'path'
{ isAllowed }         = require '../deployment/grouptoenvmapping'

Configuration = (options={}) ->

  defaultEmail =

  boot2dockerbox = if os.type() is "Darwin" then "192.168.59.103" else "localhost"

  # Softlayer Provider Keys
  slKeys       =
    vm_kloud   :
      username : ''
      apiKey   : ''

  # AWS Keys that is required for Kloud
  awsKeys =
    # s3 full access
    worker_terraformer:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # s3 put only to koding-client bucket
    worker_koding_client_s3_put_only:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # admin
    worker_test:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # s3 put only
    worker_test_data_exporter:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # AmazonRDSReadOnlyAccess
    worker_rds_log_parser:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # ELB & EC2 -> AmazonEC2ReadOnlyAccess
    worker_multi_ssh:
      accessKeyId     : "<KEY>"
      secretAccessKey : <KEY>"

    # AmazonEC2FullAccess
    worker_test_instance_launcher:
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # CloudWatchReadOnlyAccess
    vm_vmwatcher:     # vm_vmwatcher_dev
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # KloudPolicy
    vm_kloud:         # vm_kloud_dev
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # TunnelProxyPolicy
    worker_tunnelproxymanager: # Name worker_tunnelproxymanager_dev
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

    # Encryption and Storage on S3
    worker_sneakerS3 :
      accessKeyId     : "<KEY>"
      secretAccessKey : "<KEY>"

  publicPort          = options.publicPort     or "8090"
  hostname            = options.hostname       or "dev.koding.com"
  protocol            = options.protocol       or "http:"
  publicHostname      = options.publicHostname or "#{protocol}//#{hostname}"
  region              = options.region         or 'default'
  configName          = options.configName     or 'default'
  environment         = options.environment    or 'default'
  projectRoot         = options.projectRoot    or path.join __dirname, '/..'
  version             = options.version        or "2.0" # TBD
  branch              = options.branch         or "cake-rewrite"
  build               = options.build          or "1111"
  tunnelUrl           = options.tunnelUrl      or "http://devtunnelproxy.koding.com" # this is ok for now
  githubapi           =
    debug             : yes
    timeout           : 5000
    userAgent         : 'Koding-Bridge-Dev'

  mongo               = "#{boot2dockerbox}:27017/koding"
  etcd                = "#{boot2dockerbox}:4001"

  redis               = { host:     "#{boot2dockerbox}"                           , port:               "6379"                                  , db:                 0                         }
  redis.url           = "#{redis.host}:#{redis.port}"

  rabbitmq            = { host:     "#{boot2dockerbox}"                           , port:               5672                                    , apiPort:            15672                       , login:           "guest"                              , password: "<PASSWORD>"                     , vhost:         "/"                                    }
  mq                  = { host:     "#{rabbitmq.host}"                            , port:               rabbitmq.port                           , apiAddress:         "#{rabbitmq.host}"          , apiPort:         "#{rabbitmq.apiPort}"                , login:    "#{rabbitmq.login}"         , componentUser: "#{rabbitmq.login}"                      , password:       "#{rabbitmq.password}"                   , heartbeat:       10           , vhost:        "#{rabbitmq.vhost}" }

  scheme = 'http'
  _port  = if publicPort is '80' then '' else publicPort
  host   = options.host or "#{options.hostname}:#{_port}"

  local = "127.0.0.1"
  if publicPort isnt '80'
    local = "#{local}:#{publicPort}"

  customDomain        = { public: "#{scheme}://#{host}", public_: host, local: "http://#{local}", local_: "#{local}", host: "http://#{hostname}", port: 8090 }

  email               = { host:     "#{customDomain.public_}"                     , defaultFromMail:    defaultEmail                            , defaultFromName:    'Koding'                    , forcedRecipientEmail: defaultEmail                    , forcedRecipientUsername: "admin" }
  kontrol             = { url:      "#{customDomain.public}/kontrol/kite"         , port:               3000                                    , useTLS:             no                          , certFile:        ""                                   , keyFile:  ""                          , publicKeyFile: "./certs/test_kontrol_rsa_public.pem"    , privateKeyFile: "./certs/test_kontrol_rsa_private.pem"}
  broker              = { name:     "broker"                                      , serviceGenericName: "broker"                                , ip:                 ""                          , webProtocol:     "http:"                              , 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:    ''                                            , indexSuffix:        ".#{ os.hostname() }"                   }
  algoliaSecret       = { appId:    "#{algolia.appId}"                            , indexSuffix:        algolia.indexSuffix                     , apiSecretKey:       ''                          , apiSearchOnlyKey: '' }
  postgres            = { host:     "#{boot2dockerbox}"                           , port:               "5432"                                  , username:           "socialapp201506"           , password:        "<PASSWORD>"                    , dbname:   "social"                  }
  kontrolPostgres     = { host:     "#{boot2dockerbox}"                           , port:               5432                                    , username:           "kontrolapp201506"          , password:        "<PASSWORD>"                   , dbname:   "social"                    , connecttimeout: 20 }
  kiteHome            = "#{projectRoot}/kite_home/koding"
  pubnub              = { publishkey: "<KEY>", subscribekey:       "sub-c-70ab5d36-0b13-11e5-8104-0619f8945a4f"  , secretkey: "<KEY>"                               , serverAuthKey: "<KEY>"       , origin: "pubsub.pubnub.com"                              , enabled:  yes                         }
  gatekeeper          = { host:     "localhost"                                   , port:               "7200"                                  , pubnub: pubnub                                }
  integration         = { host:     "localhost"                                   , port:               "7300"                                  , url: "#{customDomain.public}/api/integration" }
  webhookMiddleware   = { host:     "localhost"                                   , port:               "7350"                                  , url: "#{customDomain.public}/api/webhook"     }
  paymentwebhook      = { port:     "6600"                                        , debug:              false                                   , secretKey: "paymentwebhooksecretkey-dev"      }
  tokbox              = { apiKey:   ""                                            , apiSecret:          "" }
  recaptcha           = { enabled: no }

  # configuration for socialapi, order will be the same with
  # ./go/src/socialapi/config/configtypes.go

  kloudPort           = 5500
  kloud               = { port : kloudPort, userPrivateKeyFile: "./certs/kloud/dev/kloud_dev_rsa.pem",    userPublicKeyfile: "./certs/kloud/dev/kloud_dev_rsa.pub",  privateKeyFile : kontrol.privateKeyFile , publicKeyFile: kontrol.publicKeyFile, kontrolUrl: kontrol.url, registerUrl : "#{customDomain.public}/kloud/kite", secretKey :  "", address : "http://localhost:#{kloudPort}/kite", tunnelUrl : "#{tunnelUrl}"}
  terraformer         = { port : 2300     , bucket:             "koding-terraformer-state-dev", localstorepath: "#{projectRoot}/go/data/terraformer" }

  googleapiServiceAccount =
    clientId              : ''
    clientSecret          : ''
    serviceAccountEmail   : ''
    serviceAccountKeyFile : ''

  segment = ''

  github =
    clientId     : "f8e440b796d953ea<PASSWORD>"
    clientSecret : "b72e2576926a5d67119d5b440107639c6499ed42"
    redirectUri  : "http://dev.koding.com:8090/-/oauth/github/callback"

{'fraction_non_alphanumeric': 0.10584569095207393, 'fraction_numerical': 0.020685579196217493, 'mean_word_length': 1.196483360868539, 'pattern_counts': {'":': 0, '<': 58, '<?xml version=': 0, '>': 62, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 97, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2820066', 'n_tokens_mistral': 5218, 'n_tokens_neox': 4869, 'n_words': 926}