diff --git a/.changeset/silent-peas-fly.md b/.changeset/silent-peas-fly.md new file mode 100644 index 0000000000..68dd6dfe47 --- /dev/null +++ b/.changeset/silent-peas-fly.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-app-api': patch +--- + +Moved the options of the config service out to the factory itself, where it belongs diff --git a/packages/backend-app-api/api-report.md b/packages/backend-app-api/api-report.md index 7ad4b590ab..e7bdc40da5 100644 --- a/packages/backend-app-api/api-report.md +++ b/packages/backend-app-api/api-report.md @@ -53,7 +53,9 @@ export interface Backend { export const cacheFactory: () => ServiceFactory; // @public (undocumented) -export const configFactory: () => ServiceFactory; +export const configFactory: ( + options?: ConfigFactoryOptions | undefined, +) => ServiceFactory; // @public (undocumented) export interface ConfigFactoryOptions { diff --git a/packages/backend-app-api/src/services/implementations/config/configFactory.ts b/packages/backend-app-api/src/services/implementations/config/configFactory.ts index 0ec15c29fe..833730fdbd 100644 --- a/packages/backend-app-api/src/services/implementations/config/configFactory.ts +++ b/packages/backend-app-api/src/services/implementations/config/configFactory.ts @@ -35,13 +35,14 @@ export interface ConfigFactoryOptions { } /** @public */ -export const configFactory = createServiceFactory({ - service: coreServices.config, - deps: {}, - async factory({}, options?: ConfigFactoryOptions) { - const { argv = process.argv, remote } = options ?? {}; - - const { config } = await loadBackendConfig({ argv, remote }); - return config; - }, -}); +export const configFactory = createServiceFactory( + (options?: ConfigFactoryOptions) => ({ + service: coreServices.config, + deps: {}, + async factory({}) { + const { argv = process.argv, remote } = options ?? {}; + const { config } = await loadBackendConfig({ argv, remote }); + return config; + }, + }), +);