diff --git a/ghost/core/core/boot.js b/ghost/core/core/boot.js index 258bcfea19..35c99d82c2 100644 --- a/ghost/core/core/boot.js +++ b/ghost/core/core/boot.js @@ -273,6 +273,16 @@ async function initDynamicRouting() { 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 * 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 {mega} = require('./server/services/mega'); const webhooks = require('./server/services/webhooks'); - const appService = require('./frontend/services/apps'); const limits = require('./server/services/limits'); const apiVersionCompatibility = require('./server/services/api-version-compatibility'); const scheduling = require('./server/adapters/scheduling'); @@ -339,7 +348,6 @@ async function initServices({config}) { emailAnalytics.init(), mega.listen(), webhooks.listen(), - appService.init(), apiVersionCompatibility.init(), scheduling.init({ apiUrl: urlUtils.urlFor('api', {type: 'admin'}, true) @@ -488,6 +496,7 @@ async function bootGhost({backend = true, frontend = true, server = true} = {}) if (frontend) { await initDynamicRouting(); + await initAppService(); } // TODO: move this to the correct place once we figure out where that is