<commit_before>traverse              = require 'traverse'
os                    = require 'os'

module.exports = (KONFIG, options, credentials) ->
  GOBIN = "%(ENV_KONFIG_PROJECTROOT)s/go/bin"
  GOPATH = "%(ENV_KONFIG_PROJECTROOT)s/go"

  workers =
    bucketproxies       :
      group             : "bucket"
      nginx             :
        s3bucket        : yes
        locations       : [
          {
            location    : '@assets'
            proxyPass   : 'http://s3.amazonaws.com/koding-assets$uri'
          }
          {
            location    : '~^/cdn/(koding-client|koding-assets|kodingdev-client|kodingdev-assets)/(.*)'
            proxyPass   : 'http://s3.amazonaws.com/$1/$2'
          }
          { # redirect /d/* to koding-dl S3 bucket; used to distributed kd/klient installers
            location    : '~^/d/(.*)$'
            proxyPass   : 'https://s3.amazonaws.com/koding-dl/$1'
          }
          { # redirect /d/kd to KD installer for development channel
            location    : '/c/d/kd'
            proxyPass   : 'https://s3.amazonaws.com/koding-kd/development/install-kd.sh'
          }
          { # redirect /p/kd to KD installer for production channel
            location    : '/c/p/kd'
            proxyPass   : 'https://s3.amazonaws.com/koding-kd/production/install-kd.sh'
          }
        ]

    assets              :
      group             : "static"
      nginx             :
        static          : yes
        locations       : [
          {
            location      : '/a/'
            proxyPass     : '$uri @assets'
            relativePath  : '/website/'
            expires       : '1M' # set -1 to disable.
            extraParamsStr: 'location ~* \.(map)$ { return 404; access_log off; }'
          }
          {
            location    : '/apidocs'
            proxyPass   : '$uri $uri/ =404'
            relativePath: '/website/'
            expires     : '-1'
          }
          {
            location    : '/swagger.json'
            proxyPass   : '$uri @assets'
            relativePath: '/website/'
            expires     : '-1'
          }
        ]

    kontrol             :
      group             : "environment"
      ports             :
        incoming        : "#{KONFIG.kontrol.port}"
      supervisord       :
        command         : "#{GOBIN}/kontrol"
      nginx             :
        websocket       : yes
        locations       : [
          {
            location    : "~^/kontrol/(.*)"
            proxyPass   : "http://kontrol/$1$is_args$args"
          }
        ]
      healthCheckURL    : "http://localhost:#{KONFIG.kontrol.port}/healthCheck"
      versionURL        : "http://localhost:#{KONFIG.kontrol.port}/version"

    kloud               :
      group             : "environment"
      ports             :
        incoming        : "#{KONFIG.kloud.port}"
      supervisord       :
        command         : "#{GOBIN}/kloud"
      nginx             :
        websocket       : yes
        locations       : [
          {
            location    : "~^/kloud/(.*)"
            proxyPass   : "http://kloud/$1$is_args$args"
          }
        ]
      healthCheckURL    : "http://localhost:#{KONFIG.kloud.port}/healthCheck"
      versionURL        : "http://localhost:#{KONFIG.kloud.port}/version"

    terraformer         :
      group             : "environment"
      supervisord       :
        command         : "#{GOBIN}/terraformer"
      healthCheckURL    : "http://localhost:#{KONFIG.terraformer.port}/healthCheck"
      versionURL        : "http://localhost:#{KONFIG.terraformer.port}/version"

    webserver           :
      group             : "webserver"
      ports             :
        incoming        : "#{KONFIG.webserver.port}"
        outgoing        : "#{KONFIG.webserver.kitePort}"
      supervisord       :
        command         : "./watch-node %(ENV_KONFIG_PROJECTROOT)s/servers/index.js"
      nginx             :
        locations       : [
          {
            location    : "~ /-/api/(.*)"
            proxyPass   : "http://webserver/-/api/$1$is_args$args"
          }<commit_msg>config: move hardcoded var into config<commit_after>traverse              = require 'traverse'
os                    = require 'os'

module.exports = (KONFIG, options, credentials) ->
  GOBIN = "%(ENV_KONFIG_PROJECTROOT)s/go/bin"
  GOPATH = "%(ENV_KONFIG_PROJECTROOT)s/go"

  workers =
    bucketproxies       :
      group             : "bucket"
      nginx             :
        s3bucket        : yes
        locations       : [
          {
            location    : '@assets'
            proxyPass   : 'http://s3.amazonaws.com/koding-assets$uri'
          }
          {
            location    : '~^/cdn/(koding-client|koding-assets|kodingdev-client|kodingdev-assets)/(.*)'
            proxyPass   : 'http://s3.amazonaws.com/$1/$2'
          }
          { # redirect /d/* to koding-dl S3 bucket; used to distributed kd/klient installers
            location    : '~^/d/(.*)$'
            proxyPass   : 'https://s3.amazonaws.com/koding-dl/$1'
          }
          { # redirect /d/kd to KD installer for development channel
            location    : '/c/d/kd'
            proxyPass   : 'https://s3.amazonaws.com/koding-kd/development/install-kd.sh'
          }
          { # redirect /p/kd to KD installer for production channel
            location    : '/c/p/kd'
            proxyPass   : 'https://s3.amazonaws.com/koding-kd/production/install-kd.sh'
          }
        ]

    assets              :
      group             : "static"
      nginx             :
        static          : yes
        locations       : [
          {
            location      : '/a/'
            proxyPass     : '$uri @assets'
            relativePath  : '/website/'
            expires       : '1M' # set -1 to disable.
            extraParamsStr: 'location ~* \.(map)$ { return 404; access_log off; }'
          }
          {
            location    : '/apidocs'
            proxyPass   : '$uri $uri/ =404'
            relativePath: '/website/'
            expires     : '-1'
          }
          {
            location    : '/swagger.json'
            proxyPass   : '$uri @assets'
            relativePath: '/website/'
            expires     : '-1'
          }
        ]

    kontrol             :
      group             : "environment"
      ports             :
        incoming        : "#{KONFIG.kontrol.port}"
      supervisord       :
        command         : "#{GOBIN}/kontrol"
      nginx             :
        websocket       : yes
        locations       : [
          {
            location    : "~^/kontrol/(.*)"
            proxyPass   : "http://kontrol/$1$is_args$args"
          }
        ]
      healthCheckURL    : "http://localhost:#{KONFIG.kontrol.port}/healthCheck"
      versionURL        : "http://localhost:#{KONFIG.kontrol.port}/version"

    kloud               :
      group             : "environment"
      ports             :
        incoming        : "#{KONFIG.kloud.port}"
      supervisord       :
        command         : "#{GOBIN}/kloud"
      nginx             :
        websocket       : yes
        locations       : [
          {
            location    : "~^/kloud/(.*)"
            proxyPass   : "http://kloud/$1$is_args$args"
          }
        ]
      healthCheckURL    : "http://localhost:#{KONFIG.kloud.port}/healthCheck"
      versionURL        : "http://localhost:#{KONFIG.kloud.port}/version"

    terraformer         :
      group             : "environment"
      supervisord       :
        command         : "#{GOBIN}/terraformer"
      healthCheckURL    : "http://localhost:#{KONFIG.terraformer.port}/healthCheck"
      versionURL        : "http://localhost:#{KONFIG.terraformer.port}/version"

    webserver           :
      group             : "webserver"
      ports             :
        incoming        : "#{KONFIG.webserver.port}"
        outgoing        : "#{KONFIG.webserver.kitePort}"
      supervisord       :
        command         : "./watch-node %(ENV_KONFIG_PROJECTROOT)s/servers/index.js"
      nginx             :
        locations       : [
          {
            location    : "~*(^(\/(Pricing|About|Legal|Features|Blog|Docs)))"
            extraParams : [ "if ($host !~* ^(dev|default|sandbox|latest|www)) { return 301 /; }" ]
          }
          {
            location    : "~ /-/api/(.*)"
            proxyPass   : "http://webserver/-/api/$1$is_args$args"
          }
{'fraction_non_alphanumeric': 0.12781065088757396, 'fraction_numerical': 0.0057988165680473375, 'mean_word_length': 1.1973478939157567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 1, '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': '4187493', 'n_tokens_mistral': 2528, 'n_tokens_neox': 2453, 'n_words': 383}