mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 14:11:05 +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
|
if envresult.error
|
||||||
throw 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_page = require('./original_page.js').original_page
|
||||||
original_text = require('./original_text.js').original_text
|
original_text = require('./original_text.js').original_text
|
||||||
favicons = require('./favicons.js').favicons
|
favicons = require('./favicons.js').favicons
|
||||||
unread_counts = require('./unread_counts.js').unread_counts
|
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({
|
if ENV_PROD
|
||||||
dsn: process.env.SENTRY_DSN,
|
Sentry.init({
|
||||||
integrations: [
|
dsn: process.env.SENTRY_DSN,
|
||||||
new Sentry.Integrations.Http({ tracing: true }),
|
integrations: [
|
||||||
new Tracing.Integrations.Express({
|
new Sentry.Integrations.Http({ tracing: true }),
|
||||||
app
|
new Tracing.Integrations.Express({
|
||||||
})
|
app
|
||||||
],
|
})
|
||||||
tracesSampleRate: 1.0
|
],
|
||||||
})
|
tracesSampleRate: 1.0
|
||||||
|
})
|
||||||
|
|
||||||
app.use(Sentry.Handlers.requestHandler())
|
app.use(Sentry.Handlers.requestHandler())
|
||||||
app.use(Sentry.Handlers.tracingHandler())
|
app.use(Sentry.Handlers.tracingHandler())
|
||||||
|
|
||||||
original_page(app)
|
original_page(app)
|
||||||
original_text(app)
|
original_text(app)
|
||||||
favicons(app)
|
favicons(app)
|
||||||
unread_counts(server)
|
unread_counts(server)
|
||||||
|
|
||||||
app.get "/debug", (req, res) ->
|
if ENV_PROD
|
||||||
throw new Error("Debugging Sentry")
|
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}"
|
log.debug "Starting NewsBlur Node Server: #{process.env.SERVER_NAME}"
|
||||||
server.listen(8008)
|
server.listen(8008)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Generated by CoffeeScript 2.5.1
|
// Generated by CoffeeScript 2.5.1
|
||||||
(function() {
|
(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");
|
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_page = require('./original_page.js').original_page;
|
||||||
|
|
||||||
original_text = require('./original_text.js').original_text;
|
original_text = require('./original_text.js').original_text;
|
||||||
|
@ -32,20 +38,24 @@
|
||||||
|
|
||||||
unread_counts = require('./unread_counts.js').unread_counts;
|
unread_counts = require('./unread_counts.js').unread_counts;
|
||||||
|
|
||||||
Sentry.init({
|
if (!ENV_DEV && !ENV_PROD && !ENV_DOCKER) {
|
||||||
dsn: process.env.SENTRY_DSN,
|
throw new Error("Set envvar NODE_ENV=<development,docker,production>");
|
||||||
integrations: [
|
}
|
||||||
new Sentry.Integrations.Http({
|
|
||||||
tracing: true
|
|
||||||
}),
|
|
||||||
new Tracing.Integrations.Express({app})
|
|
||||||
],
|
|
||||||
tracesSampleRate: 1.0
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(Sentry.Handlers.requestHandler());
|
if (ENV_PROD) {
|
||||||
|
Sentry.init({
|
||||||
app.use(Sentry.Handlers.tracingHandler());
|
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);
|
original_page(app);
|
||||||
|
|
||||||
|
@ -55,11 +65,13 @@
|
||||||
|
|
||||||
unread_counts(server);
|
unread_counts(server);
|
||||||
|
|
||||||
app.get("/debug", function(req, res) {
|
if (ENV_PROD) {
|
||||||
throw new Error("Debugging Sentry");
|
app.get("/debug", function(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}`);
|
log.debug(`Starting NewsBlur Node Server: ${process.env.SERVER_NAME}`);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue