Fixed the cloudflare config to be in the environmental variables.

This commit is contained in:
Scott Erickson 2014-06-24 12:29:47 -04:00
parent 9a571a6fe7
commit 573b566580
2 changed files with 8 additions and 1 deletions

View file

@ -3,6 +3,7 @@ fs = require 'fs'
request = require 'request'
mongoose = require('mongoose')
errors = require '../commons/errors'
config = require '../../server_config'
module.exports.setup = (app) ->
app.all '/file*', (req, res) ->
@ -176,13 +177,17 @@ createPostOptions = (req) ->
options
clearCloudFlareCacheForFile = (path='/file') ->
unless config.cloudflare.token
console.log 'skipping clearing cloud cache, not configured'
return
request = require 'request'
r = request.post 'https://www.cloudflare.com/api_json.html', (err, httpResponse, body) ->
if (err)
console.error('CloudFlare file cache clear failed:', body)
form = r.form()
form.append 'tkn', 'dea38682b209901a014dba2b2702afa5476a0'
form.append 'tkn', config.cloudflare.token
form.append 'email', 'scott@codecombat.com'
form.append 'z', 'codecombat.com'
form.append 'a', 'zone_file_purge'

View file

@ -4,6 +4,8 @@ config.unittest = process.argv.indexOf("--unittest") > -1
config.port = process.env.COCO_PORT or process.env.COCO_NODE_PORT or 3000
config.ssl_port = process.env.COCO_SSL_PORT or process.env.COCO_SSL_NODE_PORT or 3443
config.cloudflare =
token: process.env.COCO_CLOUDFLARE_API_KEY or ''
config.mongo =
port: process.env.COCO_MONGO_PORT or 27017