diff --git a/packages/backend/src/Kernel.js b/packages/backend/src/Kernel.js index 51746f56..b92ebb9b 100644 --- a/packages/backend/src/Kernel.js +++ b/packages/backend/src/Kernel.js @@ -152,17 +152,7 @@ class Kernel extends AdvancedBase { const { services } = this; await services.ready; - { - const app = services.get('web-server').app; - app.use(async (req, res, next) => { - req.services = services; - next(); - }); - await services.emit('boot.services-initialized'); - await services.emit('install.middlewares.context-aware', { app }); - await services.emit('install.routes', { app }); - await services.emit('install.routes-gui', { app }); - } + await services.emit('boot.consolidation'); // === END: Initialize Service Registry === @@ -178,9 +168,8 @@ class Kernel extends AdvancedBase { }); })(); - - await services.emit('start.webserver'); - await services.emit('ready.webserver'); + await services.emit('boot.activation'); + await services.emit('boot.ready'); } } diff --git a/packages/backend/src/services/RefreshAssociationsService.js b/packages/backend/src/services/RefreshAssociationsService.js index 94c47ccb..5485dcea 100644 --- a/packages/backend/src/services/RefreshAssociationsService.js +++ b/packages/backend/src/services/RefreshAssociationsService.js @@ -20,7 +20,7 @@ const { Context } = require("../util/context"); const BaseService = require("./BaseService"); class RefreshAssociationsService extends BaseService { - async ['__on_boot.services-initialized'] () { + async ['__on_boot.consolidation'] () { const { refresh_associations_cache } = require('../helpers'); await Context.allow_fallback(async () => { diff --git a/packages/backend/src/services/WebServerService.js b/packages/backend/src/services/WebServerService.js index 597c3fa7..73d95bb9 100644 --- a/packages/backend/src/services/WebServerService.js +++ b/packages/backend/src/services/WebServerService.js @@ -42,6 +42,20 @@ class WebServerService extends BaseService { morgan: require('morgan'), }; + async ['__on_boot.consolidation'] () { + const app = this.app; + const services = this.services; + await services.emit('install.middlewares.context-aware', { app }); + await services.emit('install.routes', { app }); + await services.emit('install.routes-gui', { app }); + } + + async ['__on_boot.activation'] () { + const services = this.services; + await services.emit('start.webserver'); + await services.emit('ready.webserver'); + } + async ['__on_start.webserver'] () { await es_import_promise;