From b729f9f31f2feeb8f319f4b58906064ad7bbecf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Tue, 7 Feb 2023 10:49:45 +0100 Subject: [PATCH] Moved the options of the config service out to the factory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/silent-peas-fly.md | 5 +++++ packages/backend-app-api/api-report.md | 4 +++- .../implementations/config/configFactory.ts | 21 ++++++++++--------- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 .changeset/silent-peas-fly.md 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; + }, + }), +);