2014-03-03 11:21:15 -05:00
|
|
|
config = {}
|
|
|
|
|
2015-12-09 17:27:10 -05:00
|
|
|
config.unittest = global.testing
|
2016-04-07 16:34:14 -04:00
|
|
|
config.proxy = process.env.COCO_PROXY
|
2014-03-03 11:21:15 -05:00
|
|
|
|
2016-04-04 22:52:10 -04:00
|
|
|
config.chinaDomain = "cn.codecombat.com"
|
|
|
|
config.brazilDomain = "br.codecombat.com"
|
2015-10-21 19:27:56 -04:00
|
|
|
config.port = process.env.COCO_PORT or process.env.COCO_NODE_PORT or process.env.PORT or 3000
|
2014-03-03 11:21:15 -05:00
|
|
|
config.ssl_port = process.env.COCO_SSL_PORT or process.env.COCO_SSL_NODE_PORT or 3443
|
2014-06-24 12:29:47 -04:00
|
|
|
config.cloudflare =
|
|
|
|
token: process.env.COCO_CLOUDFLARE_API_KEY or ''
|
2014-03-03 11:21:15 -05:00
|
|
|
|
2014-08-15 10:20:45 -04:00
|
|
|
config.github =
|
|
|
|
client_id: process.env.COCO_GITHUB_CLIENT_ID or 'fd5c9d34eb171131bc87'
|
|
|
|
client_secret: process.env.COCO_GITHUB_CLIENT_SECRET or '2555a86b83f850bc44a98c67c472adb2316a3f05'
|
|
|
|
|
2014-03-03 11:21:15 -05:00
|
|
|
config.mongo =
|
|
|
|
port: process.env.COCO_MONGO_PORT or 27017
|
2014-06-30 22:16:26 -04:00
|
|
|
host: process.env.COCO_MONGO_HOST or 'localhost'
|
|
|
|
db: process.env.COCO_MONGO_DATABASE_NAME or 'coco'
|
2015-05-01 12:37:43 -04:00
|
|
|
analytics_port: process.env.COCO_MONGO_ANALYTICS_PORT or 27017
|
|
|
|
analytics_host: process.env.COCO_MONGO_ANALYTICS_HOST or 'localhost'
|
|
|
|
analytics_db: process.env.COCO_MONGO_ANALYTICS_DATABASE_NAME or 'analytics'
|
2016-06-09 18:02:01 -04:00
|
|
|
analytics_collection: process.env.COCO_MONGO_ANALYTICS_COLLECTION or 'analytics.log.event'
|
2014-06-30 22:16:26 -04:00
|
|
|
mongoose_replica_string: process.env.COCO_MONGO_MONGOOSE_REPLICA_STRING or ''
|
2015-03-19 14:18:38 -04:00
|
|
|
mongoose_tokyo_replica_string: process.env.COCO_MONGO_MONGOOSE_TOKYO_REPLICA_STRING or ''
|
2015-09-02 12:30:31 -04:00
|
|
|
mongoose_saoPaulo_replica_string : process.env.COCO_MONGO_MONGOOSE_SAOPAULO_REPLICA_STRING or ''
|
2014-11-12 23:25:22 -05:00
|
|
|
|
2016-07-11 19:40:05 -04:00
|
|
|
if process.env.COCO_MONGO_LS_HOST? or process.env.COCO_MONGO_LS_DATABASE_NAME?
|
|
|
|
config.mongo.level_session_host = process.env.COCO_MONGO_LS_HOST or process.env.COCO_MONGO_HOST or 'localhost'
|
|
|
|
config.mongo.level_session_port = process.env.COCO_MONGO_LS_PORT or process.env.COCO_MONGO_PORT or 27017
|
|
|
|
config.mongo.level_session_db = process.env.COCO_MONGO_LS_DATABASE_NAME or process.env.COCO_MONGO_DATABASE_NAME or 'coco'
|
|
|
|
|
|
|
|
if process.env.COCO_MONGO_LS_AUX_HOST? and process.env.COCO_MONGO_LS_AUX_PORT? and process.env.COCO_MONGO_LS_AUX_DATABASE_NAME
|
|
|
|
config.mongo.level_session_aux_host = process.env.COCO_MONGO_LS_AUX_HOST or process.env.COCO_MONGO_HOST or 'localhost'
|
|
|
|
config.mongo.level_session_aux_port = process.env.COCO_MONGO_LS_AUX_PORT or process.env.COCO_MONGO_PORT or 27017
|
|
|
|
config.mongo.level_session_aux_db = process.env.COCO_MONGO_LS_AUX_DATABASE_NAME or 'coco_aux'
|
2016-06-09 18:02:01 -04:00
|
|
|
|
|
|
|
|
2015-09-02 12:30:31 -04:00
|
|
|
if config.tokyo or config.saoPaulo
|
2015-03-21 21:49:32 -04:00
|
|
|
config.mongo.readpref = 'nearest'
|
|
|
|
else
|
|
|
|
config.mongo.readpref = 'primary'
|
|
|
|
|
2014-11-11 20:40:03 -05:00
|
|
|
config.apple =
|
2014-11-17 18:15:02 -05:00
|
|
|
verifyURL: process.env.COCO_APPLE_VERIFY_URL or 'https://sandbox.itunes.apple.com/verifyReceipt'
|
2014-12-11 23:06:03 -05:00
|
|
|
|
2016-02-26 09:21:28 -05:00
|
|
|
config.closeIO =
|
|
|
|
apiKey: process.env.COCO_CLOSEIO_API_KEY or ''
|
|
|
|
|
2014-11-17 18:15:02 -05:00
|
|
|
config.stripe =
|
|
|
|
secretKey: process.env.COCO_STRIPE_SECRET_KEY or 'sk_test_MFnZHYD0ixBbiBuvTlLjl2da'
|
2014-08-10 02:11:26 -04:00
|
|
|
|
|
|
|
config.redis =
|
2014-07-09 19:24:14 -04:00
|
|
|
port: process.env.COCO_REDIS_PORT or 6379
|
|
|
|
host: process.env.COCO_REDIS_HOST or 'localhost'
|
2014-03-03 11:21:15 -05:00
|
|
|
|
|
|
|
if config.unittest
|
|
|
|
config.port += 1
|
|
|
|
config.ssl_port += 1
|
2014-06-30 22:16:26 -04:00
|
|
|
config.mongo.host = 'localhost'
|
2014-03-03 11:21:15 -05:00
|
|
|
else
|
2014-06-30 22:16:26 -04:00
|
|
|
config.mongo.username = process.env.COCO_MONGO_USERNAME or ''
|
|
|
|
config.mongo.password = process.env.COCO_MONGO_PASSWORD or ''
|
2014-03-03 11:21:15 -05:00
|
|
|
|
|
|
|
config.mail =
|
2014-12-18 23:34:59 -05:00
|
|
|
username: process.env.COCO_MAIL_SERVICE_USERNAME or ''
|
|
|
|
supportPrimary: process.env.COCO_MAIL_SUPPORT_PRIMARY or ''
|
|
|
|
supportPremium: process.env.COCO_MAIL_SUPPORT_PREMIUM or ''
|
2016-05-12 16:22:25 -04:00
|
|
|
supportSchools: process.env.COCO_MAIL_SUPPORT_SCHOOLS or ''
|
2014-06-30 22:16:26 -04:00
|
|
|
mailchimpAPIKey: process.env.COCO_MAILCHIMP_API_KEY or ''
|
|
|
|
mailchimpWebhook: process.env.COCO_MAILCHIMP_WEBHOOK or '/mail/webhook'
|
|
|
|
sendwithusAPIKey: process.env.COCO_SENDWITHUS_API_KEY or ''
|
|
|
|
stackleadAPIKey: process.env.COCO_STACKLEAD_API_KEY or ''
|
2014-08-10 02:11:26 -04:00
|
|
|
delightedAPIKey: process.env.COCO_DELIGHTED_API_KEY or ''
|
2014-06-30 22:16:26 -04:00
|
|
|
cronHandlerPublicIP: process.env.COCO_CRON_PUBLIC_IP or ''
|
|
|
|
cronHandlerPrivateIP: process.env.COCO_CRON_PRIVATE_IP or ''
|
2014-06-14 23:59:28 -04:00
|
|
|
|
2015-02-04 19:17:53 -05:00
|
|
|
config.hipchat =
|
|
|
|
main: process.env.COCO_HIPCHAT_API_KEY or ''
|
|
|
|
tower: process.env.COCO_HIPCHAT_TOWER_API_KEY or ''
|
|
|
|
artisans: process.env.COCO_HIPCHAT_ARTISANS_API_KEY or ''
|
|
|
|
|
2016-03-18 20:05:21 -04:00
|
|
|
config.slackToken = process.env.COCO_SLACK_TOKEN or ''
|
|
|
|
|
2014-03-03 11:21:15 -05:00
|
|
|
config.queue =
|
2014-06-30 22:16:26 -04:00
|
|
|
accessKeyId: process.env.COCO_AWS_ACCESS_KEY_ID or ''
|
|
|
|
secretAccessKey: process.env.COCO_AWS_SECRET_ACCESS_KEY or ''
|
|
|
|
region: 'us-east-1'
|
|
|
|
simulationQueueName: 'simulationQueue'
|
2014-03-03 11:21:15 -05:00
|
|
|
|
|
|
|
config.mongoQueue =
|
2014-06-30 22:16:26 -04:00
|
|
|
queueDatabaseName: 'coco_queue'
|
2014-03-03 11:21:15 -05:00
|
|
|
|
2014-06-30 22:16:26 -04:00
|
|
|
config.salt = process.env.COCO_SALT or 'pepper'
|
|
|
|
config.cookie_secret = process.env.COCO_COOKIE_SECRET or 'chips ahoy'
|
2014-03-03 11:21:15 -05:00
|
|
|
|
2014-06-30 22:16:26 -04:00
|
|
|
config.isProduction = config.mongo.host isnt 'localhost'
|
2014-03-03 11:21:15 -05:00
|
|
|
|
2016-02-16 18:58:29 -05:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2014-03-03 11:21:15 -05:00
|
|
|
if not config.unittest and not config.isProduction
|
|
|
|
# change artificially slow down non-static requests for testing
|
|
|
|
config.slow_down = false
|
|
|
|
|
2015-11-17 17:57:12 -05:00
|
|
|
if process.env.COCO_STATSD_HOST
|
|
|
|
config.statsd =
|
|
|
|
host: process.env.COCO_STATSD_HOST
|
|
|
|
port: process.env.COCO_STATSD_PORT or 8125
|
|
|
|
prefix: process.env.COCO_STATSD_PREFIX or ''
|
2014-03-03 11:21:15 -05:00
|
|
|
|
|
|
|
module.exports = config
|