Merge pull request #18838 from backstage/vinzscam/root-config-service

Rename ConfigService to RootConfigService
This commit is contained in:
Patrik Oldsberg
2023-08-01 13:59:11 +02:00
committed by GitHub
84 changed files with 200 additions and 140 deletions
+14 -14
View File
@@ -6,7 +6,6 @@
import { Backend } from '@backstage/backend-app-api';
import { BackendFeature } from '@backstage/backend-plugin-api';
import { CacheService } from '@backstage/backend-plugin-api';
import { ConfigService } from '@backstage/backend-plugin-api';
import { DatabaseService } from '@backstage/backend-plugin-api';
import { ExtendedHttpServer } from '@backstage/backend-app-api';
import { ExtensionPoint } from '@backstage/backend-plugin-api';
@@ -18,6 +17,7 @@ import { Knex } from 'knex';
import { LifecycleService } from '@backstage/backend-plugin-api';
import { LoggerService } from '@backstage/backend-plugin-api';
import { PermissionsService } from '@backstage/backend-plugin-api';
import { RootConfigService } from '@backstage/backend-plugin-api';
import { RootLifecycleService } from '@backstage/backend-plugin-api';
import { SchedulerService } from '@backstage/backend-plugin-api';
import { ServiceFactory } from '@backstage/backend-plugin-api';
@@ -36,19 +36,6 @@ export namespace mockServices {
factory: () => ServiceFactory<CacheService, 'plugin'>;
}
// (undocumented)
export function config(options?: config.Options): ConfigService;
// (undocumented)
export namespace config {
// (undocumented)
export type Options = {
data?: JsonObject;
};
const // (undocumented)
factory: (
options?: Options | undefined,
) => ServiceFactory<ConfigService, 'root'>;
}
// (undocumented)
export namespace database {
const // (undocumented)
factory: () => ServiceFactory<DatabaseService, 'plugin'>;
@@ -83,6 +70,19 @@ export namespace mockServices {
factory: () => ServiceFactory<PermissionsService, 'plugin'>;
}
// (undocumented)
export function rootConfig(options?: rootConfig.Options): RootConfigService;
// (undocumented)
export namespace rootConfig {
// (undocumented)
export type Options = {
data?: JsonObject;
};
const // (undocumented)
factory: (
options?: Options | undefined,
) => ServiceFactory<RootConfigService, 'root'>;
}
// (undocumented)
export namespace rootLifecycle {
const // (undocumented)
factory: () => ServiceFactory<RootLifecycleService, 'root'>;
@@ -15,7 +15,7 @@
*/
import {
ConfigService,
RootConfigService,
coreServices,
createServiceFactory,
IdentityService,
@@ -61,13 +61,13 @@ function simpleFactory<
* @public
*/
export namespace mockServices {
export function config(options?: config.Options): ConfigService {
export function rootConfig(options?: rootConfig.Options): RootConfigService {
return new ConfigReader(options?.data, 'mock-config');
}
export namespace config {
export namespace rootConfig {
export type Options = { data?: JsonObject };
export const factory = simpleFactory(coreServices.config, config);
export const factory = simpleFactory(coreServices.rootConfig, rootConfig);
}
export function rootLogger(options?: rootLogger.Options): LoggerService {
@@ -168,7 +168,7 @@ describe('TestBackend', () => {
env.registerInit({
deps: {
cache: coreServices.cache,
config: coreServices.config,
config: coreServices.rootConfig,
database: coreServices.database,
discovery: coreServices.discovery,
httpRouter: coreServices.httpRouter,
@@ -73,7 +73,7 @@ export interface TestBackend extends Backend {
const defaultServiceFactories = [
mockServices.cache.factory(),
mockServices.config.factory(),
mockServices.rootConfig.factory(),
mockServices.database.factory(),
mockServices.httpRouter.factory(),
mockServices.identity.factory(),
@@ -108,7 +108,7 @@ export async function startTestBackend<
const rootHttpRouterFactory = createServiceFactory({
service: coreServices.rootHttpRouter,
deps: {
config: coreServices.config,
config: coreServices.rootConfig,
lifecycle: coreServices.rootLifecycle,
rootLogger: coreServices.rootLogger,
},