mirror of
https://github.com/viq/NewsBlur.git
synced 2025-04-13 09:38:09 +00:00
Only using Sentry in production.
This commit is contained in:
parent
6bd76040b6
commit
d4e666cefd
2 changed files with 55 additions and 34 deletions
|
@ -10,35 +10,44 @@ if envresult.error
|
|||
if envresult.error
|
||||
throw envresult.error
|
||||
|
||||
ENV_DEV = process.env.NODE_ENV == 'development'
|
||||
ENV_PROD = process.env.NODE_ENV == 'production'
|
||||
ENV_DOCKER = process.env.NODE_ENV == 'docker'
|
||||
|
||||
original_page = require('./original_page.js').original_page
|
||||
original_text = require('./original_text.js').original_text
|
||||
favicons = require('./favicons.js').favicons
|
||||
unread_counts = require('./unread_counts.js').unread_counts
|
||||
|
||||
if not ENV_DEV and not ENV_PROD and not ENV_DOCKER
|
||||
throw new Error("Set envvar NODE_ENV=<development,docker,production>")
|
||||
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
integrations: [
|
||||
new Sentry.Integrations.Http({ tracing: true }),
|
||||
new Tracing.Integrations.Express({
|
||||
app
|
||||
})
|
||||
],
|
||||
tracesSampleRate: 1.0
|
||||
})
|
||||
if ENV_PROD
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
integrations: [
|
||||
new Sentry.Integrations.Http({ tracing: true }),
|
||||
new Tracing.Integrations.Express({
|
||||
app
|
||||
})
|
||||
],
|
||||
tracesSampleRate: 1.0
|
||||
})
|
||||
|
||||
app.use(Sentry.Handlers.requestHandler())
|
||||
app.use(Sentry.Handlers.tracingHandler())
|
||||
app.use(Sentry.Handlers.requestHandler())
|
||||
app.use(Sentry.Handlers.tracingHandler())
|
||||
|
||||
original_page(app)
|
||||
original_text(app)
|
||||
favicons(app)
|
||||
unread_counts(server)
|
||||
|
||||
app.get "/debug", (req, res) ->
|
||||
throw new Error("Debugging Sentry")
|
||||
if ENV_PROD
|
||||
app.get "/debug", (req, res) ->
|
||||
throw new Error("Debugging Sentry")
|
||||
|
||||
app.use(Sentry.Handlers.errorHandler())
|
||||
app.use(Sentry.Handlers.errorHandler())
|
||||
log.debug "Setitng up Sentry debugging: #{process.env.SENTRY_DSN.substr(0, 20)}..."
|
||||
|
||||
log.debug "Starting NewsBlur Node Server: #{process.env.SERVER_NAME}"
|
||||
server.listen(8008)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Generated by CoffeeScript 2.5.1
|
||||
(function() {
|
||||
var Sentry, Tracing, app, envresult, favicons, log, original_page, original_text, server, unread_counts;
|
||||
var ENV_DEV, ENV_DOCKER, ENV_PROD, Sentry, Tracing, app, envresult, favicons, log, original_page, original_text, server, unread_counts;
|
||||
|
||||
Sentry = require("@sentry/node");
|
||||
|
||||
|
@ -24,6 +24,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
ENV_DEV = process.env.NODE_ENV === 'development';
|
||||
|
||||
ENV_PROD = process.env.NODE_ENV === 'production';
|
||||
|
||||
ENV_DOCKER = process.env.NODE_ENV === 'docker';
|
||||
|
||||
original_page = require('./original_page.js').original_page;
|
||||
|
||||
original_text = require('./original_text.js').original_text;
|
||||
|
@ -32,20 +38,24 @@
|
|||
|
||||
unread_counts = require('./unread_counts.js').unread_counts;
|
||||
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
integrations: [
|
||||
new Sentry.Integrations.Http({
|
||||
tracing: true
|
||||
}),
|
||||
new Tracing.Integrations.Express({app})
|
||||
],
|
||||
tracesSampleRate: 1.0
|
||||
});
|
||||
if (!ENV_DEV && !ENV_PROD && !ENV_DOCKER) {
|
||||
throw new Error("Set envvar NODE_ENV=<development,docker,production>");
|
||||
}
|
||||
|
||||
app.use(Sentry.Handlers.requestHandler());
|
||||
|
||||
app.use(Sentry.Handlers.tracingHandler());
|
||||
if (ENV_PROD) {
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
integrations: [
|
||||
new Sentry.Integrations.Http({
|
||||
tracing: true
|
||||
}),
|
||||
new Tracing.Integrations.Express({app})
|
||||
],
|
||||
tracesSampleRate: 1.0
|
||||
});
|
||||
app.use(Sentry.Handlers.requestHandler());
|
||||
app.use(Sentry.Handlers.tracingHandler());
|
||||
}
|
||||
|
||||
original_page(app);
|
||||
|
||||
|
@ -55,11 +65,13 @@
|
|||
|
||||
unread_counts(server);
|
||||
|
||||
app.get("/debug", function(req, res) {
|
||||
throw new Error("Debugging Sentry");
|
||||
});
|
||||
|
||||
app.use(Sentry.Handlers.errorHandler());
|
||||
if (ENV_PROD) {
|
||||
app.get("/debug", function(req, res) {
|
||||
throw new Error("Debugging Sentry");
|
||||
});
|
||||
app.use(Sentry.Handlers.errorHandler());
|
||||
log.debug(`Setitng up Sentry debugging: ${process.env.SENTRY_DSN.substr(0, 20)}...`);
|
||||
}
|
||||
|
||||
log.debug(`Starting NewsBlur Node Server: ${process.env.SERVER_NAME}`);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue