diff --git a/.changeset/fast-tools-fix.md b/.changeset/fast-tools-fix.md index 25dd292c82..11807f045e 100644 --- a/.changeset/fast-tools-fix.md +++ b/.changeset/fast-tools-fix.md @@ -2,7 +2,7 @@ '@backstage/backend-defaults': minor --- -**BREAKING CHANGE**: The `LifecycleMiddlewareOptions.startupRequestPauseTimeout` has been removed. Use the `backend.lifecycle.startupRequestPauseTimeout` setting in your `app-config.yaml` file to customize how the `createLifecycleMiddleware` function should behave. Also the root config service is required as an options when calling the `createLifecycleMiddleware` function: +**BREAKING PRODUCERS**: The `LifecycleMiddlewareOptions.startupRequestPauseTimeout` has been removed. Use the `backend.lifecycle.startupRequestPauseTimeout` setting in your `app-config.yaml` file to customize how the `createLifecycleMiddleware` function should behave. Also the root config service is required as an option when calling the `createLifecycleMiddleware` function: ```diff - createLifecycleMiddleware({ lifecycle, startupRequestPauseTimeout }) diff --git a/packages/backend-defaults/src/entrypoints/httpRouter/http/createLifecycleMiddleware.ts b/packages/backend-defaults/src/entrypoints/httpRouter/http/createLifecycleMiddleware.ts index 444b0c08f9..366d19f8bf 100644 --- a/packages/backend-defaults/src/entrypoints/httpRouter/http/createLifecycleMiddleware.ts +++ b/packages/backend-defaults/src/entrypoints/httpRouter/http/createLifecycleMiddleware.ts @@ -51,7 +51,7 @@ export interface LifecycleMiddlewareOptions { export function createLifecycleMiddleware( options: LifecycleMiddlewareOptions, ): RequestHandler { - const { lifecycle } = options; + const { config, lifecycle } = options; let state: 'init' | 'up' | 'down' = 'init'; const waiting = new Set<{ @@ -82,11 +82,8 @@ export function createLifecycleMiddleware( let startupRequestPauseTimeout: HumanDuration = DEFAULT_TIMEOUT; - if ( - 'config' in options && - options.config.has('backend.lifecycle.startupRequestPauseTimeout') - ) { - startupRequestPauseTimeout = readDurationFromConfig(options.config, { + if (config.has('backend.lifecycle.startupRequestPauseTimeout')) { + startupRequestPauseTimeout = readDurationFromConfig(config, { key: 'backend.lifecycle.startupRequestPauseTimeout', }); }