use sentry

This commit is contained in:
jysperm
2015-03-10 23:26:07 +08:00
parent 5f730b3e81
commit 1bc8512cbe
3 changed files with 19 additions and 5 deletions

View File

@@ -5,10 +5,17 @@ harp = require 'harp'
path = require 'path'
ical = require 'ical-generator'
redis = require 'redis'
raven = require 'raven'
_ = require 'underscore'
config = require './config'
if config.sentry != 'sentry-api-key'
sentry = new raven.Client config.sentry
sentry.patchGlobal()
else
sentry = null
redis_client = redis.createClient()
sendRequest = (path, callback) ->
@@ -77,8 +84,12 @@ app.get '/:username', (req, res) ->
cal.addEvent commit
console.log "Request by: #{username}, X-RateLimit-Remaining: #{_res.headers['x-ratelimit-remaining']}"
sentry?.captureMessage username
res.header 'Content-Type', 'text/calendar; charset=utf-8'
res.status(200).end(cal.toString())
if config.sentry != 'sentry-api-key'
app.use raven.middleware.express config.sentry
app.listen 19864

View File

@@ -2,3 +2,5 @@ module.exports =
auth:
user: 'username'
pass: 'personal-access-tokens'
sentry: 'sentry-api-key'

View File

@@ -19,13 +19,14 @@
"start": "./node_modules/.bin/coffee app.coffee"
},
"dependencies": {
"async": "^0.9.0",
"coffee-script": "^1.7.1",
"express": "^4.10.0",
"request": "^2.47.0",
"ical-generator": "^0.1.9",
"harp": "^0.14.0",
"async": "^0.9.0",
"underscore": "^1.7.0",
"redis": "^0.12.1"
"ical-generator": "^0.1.9",
"raven": "^0.7.3",
"redis": "^0.12.1",
"request": "^2.47.0",
"underscore": "^1.7.0"
}
}