2015-05-28 10:16:09 -05:00
|
|
|
// # Ghost Startup
|
|
|
|
// Orchestrates the startup of Ghost when run from command line.
|
2016-09-14 09:50:17 -05:00
|
|
|
var ghost = require('./core'),
|
2016-10-03 03:33:14 -05:00
|
|
|
debug = require('debug')('ghost:boot:index'),
|
2016-09-14 09:50:17 -05:00
|
|
|
express = require('express'),
|
2016-10-04 10:33:43 -05:00
|
|
|
logging = require('./core/server/logging'),
|
2016-09-12 06:53:04 -05:00
|
|
|
utils = require('./core/server/utils'),
|
2016-09-14 09:50:17 -05:00
|
|
|
parentApp = express();
|
2016-06-03 03:06:18 -05:00
|
|
|
|
2016-10-03 03:33:14 -05:00
|
|
|
debug('Initialising Ghost');
|
2014-09-19 11:17:58 -05:00
|
|
|
ghost().then(function (ghostServer) {
|
2015-05-28 10:16:09 -05:00
|
|
|
// Mount our Ghost instance on our desired subdirectory path if it exists.
|
2016-09-12 06:53:04 -05:00
|
|
|
parentApp.use(utils.url.getSubdir(), ghostServer.rootApp);
|
2014-08-23 15:42:44 -05:00
|
|
|
|
2016-10-03 03:33:14 -05:00
|
|
|
debug('Starting Ghost');
|
2015-05-28 10:16:09 -05:00
|
|
|
// Let Ghost handle starting our server instance.
|
2014-09-19 11:17:58 -05:00
|
|
|
ghostServer.start(parentApp);
|
2014-08-19 11:36:46 -05:00
|
|
|
}).catch(function (err) {
|
2016-10-04 10:33:43 -05:00
|
|
|
logging.error(err);
|
|
|
|
process.exit(0);
|
2014-08-19 11:36:46 -05:00
|
|
|
});
|