mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
584bd15b76
refs #7489 - as we are now using a different migration approach (knex-migrator), we don't need to remember the database version anymore - it was once used to check the state of a database and based on it we decided to migrate or not - with knex-migrator everything depends on the migration table entries and the current ghost version you are on - on current master the leftover usage is to add the db version when exporting the database, which can be replaced by reading the ghost version - removing this solves also an interesting migration case with knex-migrator: - you are on 1.0 - you update to 1.1, but 1.1 has no migrations - the db version would remain in 1.0 - because the db version was only updated when knex migrator executed a migration
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
// # Ghost Startup
|
|
// Orchestrates the startup of Ghost when run from command line.
|
|
var ghost = require('./core'),
|
|
debug = require('debug')('ghost:boot:index'),
|
|
express = require('express'),
|
|
logging = require('./core/server/logging'),
|
|
errors = require('./core/server/errors'),
|
|
utils = require('./core/server/utils'),
|
|
parentApp = express();
|
|
|
|
debug('Initialising Ghost');
|
|
ghost().then(function (ghostServer) {
|
|
// Mount our Ghost instance on our desired subdirectory path if it exists.
|
|
parentApp.use(utils.url.getSubdir(), ghostServer.rootApp);
|
|
|
|
debug('Starting Ghost');
|
|
// Let Ghost handle starting our server instance.
|
|
return ghostServer.start(parentApp).then(function afterStart() {
|
|
// if IPC messaging is enabled, ensure ghost sends message to parent
|
|
// process on successful start
|
|
if (process.send) {
|
|
process.send({started: true});
|
|
}
|
|
});
|
|
}).catch(function (err) {
|
|
if (!errors.utils.isIgnitionError(err)) {
|
|
err = new errors.GhostError({err: err});
|
|
}
|
|
|
|
if (process.send) {
|
|
process.send({started: false, error: err.message});
|
|
}
|
|
|
|
logging.error(err);
|
|
process.exit(-1);
|
|
});
|