feat(api): enable Sentry reporting

This commit is contained in:
Oliver Eyton-Williams
2020-03-23 18:31:25 +01:00
committed by Mrugesh Mohapatra
parent 61e5bf942b
commit 10a6622546
7 changed files with 47 additions and 7 deletions

View File

@ -7,14 +7,26 @@ const loopback = require('loopback');
const boot = require('loopback-boot');
const expressState = require('express-state');
const createDebugger = require('debug');
const Sentry = require('@sentry/node');
const { sentry } = require('../../config/secrets');
const { setupPassport } = require('./component-passport');
const log = createDebugger('fcc:server');
// force logger to always output
// this may be brittle
log.enabled = true;
if (sentry.dns === 'dsn_from_sentry_dashboard') {
log('Sentry reporting disabled unless DSN is provided.');
} else {
Sentry.init({
dsn: sentry.dns
});
log('Sentry initialized');
}
Rx.config.longStackSupport = process.env.NODE_DEBUG !== 'production';
const app = loopback();