mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
7751e78c98
no issue - this allows tracking of application errors within Sentry - only enabled for HTTP 500 errors for now - it is disabled by default
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
// # Ghost Startup
|
|
// Orchestrates the startup of Ghost when run from command line.
|
|
|
|
var startTime = Date.now(),
|
|
debug = require('ghost-ignition').debug('boot:index'),
|
|
sentry = require('./core/server/sentry'),
|
|
ghost, express, common, urlService, parentApp;
|
|
|
|
debug('First requires...');
|
|
|
|
ghost = require('./core');
|
|
|
|
debug('Required ghost');
|
|
|
|
express = require('express');
|
|
common = require('./core/server/lib/common');
|
|
urlService = require('./core/frontend/services/url');
|
|
parentApp = express();
|
|
|
|
parentApp.use(sentry.requestHandler);
|
|
|
|
debug('Initialising Ghost');
|
|
ghost().then(function (ghostServer) {
|
|
// Mount our Ghost instance on our desired subdirectory path if it exists.
|
|
parentApp.use(urlService.utils.getSubdir(), ghostServer.rootApp);
|
|
|
|
debug('Starting Ghost');
|
|
// Let Ghost handle starting our server instance.
|
|
return ghostServer.start(parentApp)
|
|
.then(function afterStart() {
|
|
common.logging.info('Ghost boot', (Date.now() - startTime) / 1000 + 's');
|
|
});
|
|
}).catch(function (err) {
|
|
common.logging.error(err);
|
|
setTimeout(() => {
|
|
process.exit(-1);
|
|
}, 100);
|
|
});
|