2015-05-28 18:16:09 +03:00
|
|
|
// # Ghost Startup
|
|
|
|
// Orchestrates the startup of Ghost when run from command line.
|
2016-06-03 11:06:18 +03:00
|
|
|
|
2016-09-14 17:50:17 +03:00
|
|
|
var ghost = require('./core'),
|
|
|
|
express = require('express'),
|
|
|
|
errors = require('./core/server/errors'),
|
|
|
|
parentApp = express();
|
2016-06-03 11:06:18 +03:00
|
|
|
|
2014-09-01 23:46:37 +04:00
|
|
|
// Make sure dependencies are installed and file system permissions are correct.
|
|
|
|
require('./core/server/utils/startup-check').check();
|
|
|
|
|
2014-09-19 20:17:58 +04:00
|
|
|
ghost().then(function (ghostServer) {
|
2015-05-28 18:16:09 +03:00
|
|
|
// Mount our Ghost instance on our desired subdirectory path if it exists.
|
2014-09-19 20:17:58 +04:00
|
|
|
parentApp.use(ghostServer.config.paths.subdir, ghostServer.rootApp);
|
2014-08-24 00:42:44 +04:00
|
|
|
|
2015-05-28 18:16:09 +03:00
|
|
|
// Let Ghost handle starting our server instance.
|
2014-09-19 20:17:58 +04:00
|
|
|
ghostServer.start(parentApp);
|
2014-08-19 20:36:46 +04:00
|
|
|
}).catch(function (err) {
|
2014-02-20 07:22:02 +04:00
|
|
|
errors.logErrorAndExit(err, err.context, err.help);
|
2014-08-19 20:36:46 +04:00
|
|
|
});
|