mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 03:42:27 +03:00
Added Sentry to new boot process
- With the new boot finalised it's clearer to see where this needs to go - Update comments to add more clarity around what's happening and why - Cleaned up the version require, as this was prep for maybe using version via config, which won't work in MigratorConfig
This commit is contained in:
parent
ab65f70ef1
commit
4b472615a8
@ -1,5 +1,5 @@
|
||||
const sentry = require('./shared/sentry');
|
||||
const express = require('./shared/express');
|
||||
const rootApp = express('root');
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@ -16,6 +16,9 @@ const maintenanceMiddleware = (req, res, next) => {
|
||||
fs.createReadStream(path.resolve(__dirname, './server/views/maintenance.html')).pipe(res);
|
||||
};
|
||||
|
||||
const rootApp = express('root');
|
||||
rootApp.use(sentry.requestHandler);
|
||||
|
||||
rootApp.enable('maintenance');
|
||||
rootApp.use(maintenanceMiddleware);
|
||||
|
||||
|
12
core/boot.js
12
core/boot.js
@ -111,7 +111,7 @@ const mountGhost = (rootApp, ghostApp) => {
|
||||
};
|
||||
|
||||
const bootGhost = async () => {
|
||||
// Metrics & debugging
|
||||
// Metrics
|
||||
const startTime = Date.now();
|
||||
let ghostServer;
|
||||
|
||||
@ -121,11 +121,17 @@ const bootGhost = async () => {
|
||||
const config = require('./shared/config');
|
||||
debug('End: Load config');
|
||||
|
||||
// Version is required by sentry & Migratior config & so is fundamental to booting
|
||||
// However, it involves reading package.json, so put it here for visibility on how slow it is
|
||||
debug('Begin: Load version info');
|
||||
const version = require('./server/lib/ghost-version');
|
||||
config.set('version', version);
|
||||
require('./server/lib/ghost-version');
|
||||
debug('End: Load version info');
|
||||
|
||||
// Sentry must be initialised early, but requires config
|
||||
debug('Begin: Load sentry');
|
||||
require('./shared/sentry');
|
||||
debug('End: Load sentry');
|
||||
|
||||
debug('Begin: load server + minimal app');
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user