mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Prevent app services from starting when Ghost is booted without frontend
refs: https://github.com/TryGhost/Toolbox/issues/389 Prevents errors caused when attempting to setup the appService, which relies on the frontend.
This commit is contained in:
parent
64d94c8c8c
commit
8a11ac936d
@ -273,6 +273,16 @@ async function initDynamicRouting() {
|
|||||||
debug('End: Dynamic Routing');
|
debug('End: Dynamic Routing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The app service cannot be loaded unless the frontend is enabled
|
||||||
|
* In future, the logic to determine whether this should be loaded should be in the service loader
|
||||||
|
*/
|
||||||
|
async function initAppService() {
|
||||||
|
debug('Begin: App Service');
|
||||||
|
const appService = require('./frontend/services/apps');
|
||||||
|
await appService.init();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Services are components that make up part of Ghost and need initializing on boot
|
* Services are components that make up part of Ghost and need initializing on boot
|
||||||
* These services should all be part of core, frontend services should be loaded with the frontend
|
* These services should all be part of core, frontend services should be loaded with the frontend
|
||||||
@ -293,7 +303,6 @@ async function initServices({config}) {
|
|||||||
const slack = require('./server/services/slack');
|
const slack = require('./server/services/slack');
|
||||||
const {mega} = require('./server/services/mega');
|
const {mega} = require('./server/services/mega');
|
||||||
const webhooks = require('./server/services/webhooks');
|
const webhooks = require('./server/services/webhooks');
|
||||||
const appService = require('./frontend/services/apps');
|
|
||||||
const limits = require('./server/services/limits');
|
const limits = require('./server/services/limits');
|
||||||
const apiVersionCompatibility = require('./server/services/api-version-compatibility');
|
const apiVersionCompatibility = require('./server/services/api-version-compatibility');
|
||||||
const scheduling = require('./server/adapters/scheduling');
|
const scheduling = require('./server/adapters/scheduling');
|
||||||
@ -339,7 +348,6 @@ async function initServices({config}) {
|
|||||||
emailAnalytics.init(),
|
emailAnalytics.init(),
|
||||||
mega.listen(),
|
mega.listen(),
|
||||||
webhooks.listen(),
|
webhooks.listen(),
|
||||||
appService.init(),
|
|
||||||
apiVersionCompatibility.init(),
|
apiVersionCompatibility.init(),
|
||||||
scheduling.init({
|
scheduling.init({
|
||||||
apiUrl: urlUtils.urlFor('api', {type: 'admin'}, true)
|
apiUrl: urlUtils.urlFor('api', {type: 'admin'}, true)
|
||||||
@ -488,6 +496,7 @@ async function bootGhost({backend = true, frontend = true, server = true} = {})
|
|||||||
|
|
||||||
if (frontend) {
|
if (frontend) {
|
||||||
await initDynamicRouting();
|
await initDynamicRouting();
|
||||||
|
await initAppService();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move this to the correct place once we figure out where that is
|
// TODO: move this to the correct place once we figure out where that is
|
||||||
|
Loading…
Reference in New Issue
Block a user