mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Split CLIENT_ and NODE_ SENTRY_DSN vars
This commit is contained in:
parent
7ed45cb5dd
commit
8536006416
2 changed files with 5 additions and 5 deletions
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
ga_tracker: process.env.GA_TRACKER || '',
|
||||
|
||||
// Error handling
|
||||
sentry_dsn: process.env.SENTRY_DSN || '',
|
||||
sentry_dsn: process.env.CLIENT_SENTRY_DSN || '',
|
||||
|
||||
// Use minified JS libraries
|
||||
min: (process.env.NODE_ENV === 'production') ? '.min' : ''
|
||||
|
|
|
@ -47,20 +47,20 @@ for (var routeId in routes) {
|
|||
app.get(route.pattern, handler(route));
|
||||
}
|
||||
|
||||
if (typeof process.env.SENTRY_DSN === 'string') {
|
||||
if (typeof process.env.NODE_SENTRY_DSN === 'string') {
|
||||
var raven = require('raven');
|
||||
app.get('/sentrythrow', function mainHandler () { throw new Error('Sentry Test'); });
|
||||
|
||||
// These handlers must be applied _AFTER_ other routes have been applied
|
||||
app.use(raven.middleware.express.requestHandler(process.env.SENTRY_DSN));
|
||||
app.use(raven.middleware.express.errorHandler(process.env.SENTRY_DSN));
|
||||
app.use(raven.middleware.express.requestHandler(process.env.NODE_SENTRY_DSN));
|
||||
app.use(raven.middleware.express.errorHandler(process.env.NODE_SENTRY_DSN));
|
||||
app.use(function errorHandler (err, req, res, next) {
|
||||
res.append('X-Sentry-ID:' + res.sentry);
|
||||
res.status(500);
|
||||
next(err);
|
||||
});
|
||||
|
||||
raven.patchGlobal(process.env.SENTRY_DSN, function () {
|
||||
raven.patchGlobal(process.env.NODE_SENTRY_DSN, function () {
|
||||
process.exit(-1);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue