0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Exposed async route settings loading method

refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- There's no reason for the boot to block the event by loading route settings sychronously
- The only leftover use of a sync loader might also be refactored in some way to avoid blocking the event loo - for example by caching the value on the service layer.
This commit is contained in:
Naz 2021-09-27 14:15:06 +02:00 committed by naz
parent 85f18850a9
commit 0586a73c6d
2 changed files with 2 additions and 1 deletions

View file

@ -152,7 +152,7 @@ async function initDynamicRouting() {
// We pass the frontend API version + the dynamic routes here, so that the frontend services are slightly less tightly-coupled
const apiVersion = bridge.getFrontendApiVersion();
const routeSettings = routeSettingsService.loadRouteSettingsSync();
const routeSettings = await routeSettingsService.loadRouteSettings();
debug(`Frontend API Version: ${apiVersion}`);
routing.bootstrap.start(apiVersion, routeSettings);

View file

@ -146,6 +146,7 @@ const init = function () {
module.exports.init = init;
module.exports.loadRouteSettingsSync = SettingsLoader.loadSettingsSync;
module.exports.loadRouteSettings = SettingsLoader.loadSettings;
module.exports.api = {
setFromFilePath: setFromFilePath,