Moved the options of the config service out to the factory

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2023-02-07 10:49:45 +01:00
parent 606bb891c1
commit b729f9f31f
3 changed files with 19 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-app-api': patch
---
Moved the options of the config service out to the factory itself, where it belongs
+3 -1
View File
@@ -53,7 +53,9 @@ export interface Backend {
export const cacheFactory: () => ServiceFactory<PluginCacheManager>;
// @public (undocumented)
export const configFactory: () => ServiceFactory<ConfigService>;
export const configFactory: (
options?: ConfigFactoryOptions | undefined,
) => ServiceFactory<ConfigService>;
// @public (undocumented)
export interface ConfigFactoryOptions {
@@ -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;
},
}),
);