mirror of
https://github.com/HackPlan/github-commit-ical.git
synced 2026-01-12 15:04:45 +08:00
use sentry
This commit is contained in:
11
app.coffee
11
app.coffee
@@ -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
|
||||
|
||||
@@ -2,3 +2,5 @@ module.exports =
|
||||
auth:
|
||||
user: 'username'
|
||||
pass: 'personal-access-tokens'
|
||||
|
||||
sentry: 'sentry-api-key'
|
||||
|
||||
11
package.json
11
package.json
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user