1 Star 0 Fork 0

城北徐公/codecombat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server_config.coffee 2.22 KB
一键复制 编辑 原始数据 按行查看 历史
堂吉诃德 提交于 2021-12-28 23:14 . init
fs = require 'fs'
path = require 'path'
os = require 'os'
cluster = require 'cluster'
config = {}
if process.env.COCO_SECRETS_JSON_BUNDLE
for k, v of JSON.parse(process.env.COCO_SECRETS_JSON_BUNDLE)
process.env[k] = v
config.clusterID = "#{os.hostname()}"
if cluster.worker?
config.clusterID += "/#{cluster.worker.id}"
config.unittest = global.testing
config.proxy = process.env.COCO_PROXY
config.timeout = parseInt(process.env.COCO_TIMEOUT) or 60*1000
config.chinaDomain = "bridge.koudashijie.com;koudashijie.com;ccombat.cn;contributors.codecombat.com"
config.chinaInfra = process.env.COCO_CHINA_INFRASTRUCTURE or false
config.port = process.env.COCO_PORT or process.env.COCO_NODE_PORT or process.env.PORT or 3000
if config.unittest
config.port += 1
config.cookie_secret = process.env.COCO_COOKIE_SECRET or 'chips ahoy'
config.isProduction = false
# Domains (without subdomain prefix, with port number) for main hostname (usually codecombat.com)
# and unsafe web-dev iFrame content (usually codecombatprojects.com).
config.mainHostname = process.env.COCO_MAIN_HOSTNAME or 'localhost:3000'
config.unsafeContentHostname = process.env.COCO_UNSAFE_CONTENT_HOSTNAME or 'localhost:3000'
if process.env.COCO_PICOCTF
config.picoCTF = true
config.picoCTF_api_url = 'http://staging.picoctf.com/api'
config.picoCTF_login_URL = 'http://staging.picoctf.com'
config.picoCTF_auth = {username: 'picodev', password: 'pico2016rox!ftw'}
else
config.picoCTF = false
if not config.unittest and not config.isProduction
# change artificially slow down non-static requests for testing
config.slow_down = false
config.buildInfo = { sha: 'dev' }
if fs.existsSync path.join(__dirname, '.build_info.json')
config.buildInfo = JSON.parse fs.readFileSync path.join(__dirname, '.build_info.json'), 'utf8'
# This logs a stack trace every time an endpoint sends a response or throws an error.
# It's great for finding where a mystery endpoint is!
config.TRACE_ROUTES = process.env.TRACE_ROUTES?
# Enables server-side gzip compression for network responses
# Only use this if testing network response sizes in development
# (In production, CloudFlare compresses things for us!)
config.forceCompression = process.env.COCO_FORCE_COMPRESSION?
module.exports = config
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/HeroYx/codecombat.git
git@gitee.com:HeroYx/codecombat.git
HeroYx
codecombat
codecombat
master

搜索帮助