@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-defaults': patch
|
||||
---
|
||||
|
||||
Accept `ConfigService` instead of `Config` in constructors/factories
|
||||
@@ -5,15 +5,15 @@
|
||||
```ts
|
||||
import { CacheService } from '@backstage/backend-plugin-api';
|
||||
import { CacheServiceOptions } from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { RootConfigService } from '@backstage/backend-plugin-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public
|
||||
export class CacheManager {
|
||||
forPlugin(pluginId: string): PluginCacheManager;
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
config: RootConfigService,
|
||||
options?: CacheManagerOptions,
|
||||
): CacheManager;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DatabaseService } from '@backstage/backend-plugin-api';
|
||||
import { LifecycleService } from '@backstage/backend-plugin-api';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { PluginMetadataService } from '@backstage/backend-plugin-api';
|
||||
import { RootConfigService } from '@backstage/backend-plugin-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public
|
||||
@@ -20,7 +21,7 @@ export class DatabaseManager implements LegacyRootDatabaseService {
|
||||
},
|
||||
): DatabaseService;
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
config: RootConfigService,
|
||||
options?: DatabaseManagerOptions,
|
||||
): DatabaseManager;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
import { RootConfigService } from '@backstage/backend-plugin-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
|
||||
// @public
|
||||
@@ -17,7 +17,7 @@ export const discoveryServiceFactory: ServiceFactory<
|
||||
// @public
|
||||
export class HostDiscovery implements DiscoveryService {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
config: RootConfigService,
|
||||
options?: {
|
||||
basePath?: string;
|
||||
},
|
||||
|
||||
@@ -12,7 +12,6 @@ import { AzureIntegration } from '@backstage/integration';
|
||||
import { BitbucketCloudIntegration } from '@backstage/integration';
|
||||
import { BitbucketIntegration } from '@backstage/integration';
|
||||
import { BitbucketServerIntegration } from '@backstage/integration';
|
||||
import { Config } from '@backstage/config';
|
||||
import { GerritIntegration } from '@backstage/integration';
|
||||
import { GiteaIntegration } from '@backstage/integration';
|
||||
import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
@@ -21,6 +20,7 @@ import { GitLabIntegration } from '@backstage/integration';
|
||||
import { HarnessIntegration } from '@backstage/integration';
|
||||
import { LoggerService } from '@backstage/backend-plugin-api';
|
||||
import { Readable } from 'stream';
|
||||
import { RootConfigService } from '@backstage/backend-plugin-api';
|
||||
import { ServiceFactory } from '@backstage/backend-plugin-api';
|
||||
import { ServiceRef } from '@backstage/backend-plugin-api';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
@@ -360,7 +360,7 @@ export class HarnessUrlReader implements UrlReaderService {
|
||||
|
||||
// @public
|
||||
export type ReaderFactory = (options: {
|
||||
config: Config;
|
||||
config: RootConfigService;
|
||||
logger: LoggerService;
|
||||
treeResponseFactory: ReadTreeResponseFactory;
|
||||
}) => UrlReaderPredicateTuple[];
|
||||
@@ -442,7 +442,7 @@ export const urlReaderServiceFactory: ServiceFactory<
|
||||
|
||||
// @public
|
||||
export type UrlReadersOptions = {
|
||||
config: Config;
|
||||
config: RootConfigService;
|
||||
logger: LoggerService;
|
||||
factories?: ReaderFactory[];
|
||||
};
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
import {
|
||||
CacheServiceOptions,
|
||||
LoggerService,
|
||||
RootConfigService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import Keyv from 'keyv';
|
||||
import { DefaultCacheClient } from './CacheClient';
|
||||
import {
|
||||
@@ -62,7 +62,7 @@ export class CacheManager {
|
||||
* @param config - The loaded application configuration.
|
||||
*/
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
config: RootConfigService,
|
||||
options: CacheManagerOptions = {},
|
||||
): CacheManager {
|
||||
// If no `backend.cache` config is provided, instantiate the CacheManager
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
LifecycleService,
|
||||
LoggerService,
|
||||
PluginMetadataService,
|
||||
RootConfigService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import { stringifyError } from '@backstage/errors';
|
||||
@@ -200,7 +201,7 @@ export class DatabaseManager implements LegacyRootDatabaseService {
|
||||
* @param options - An optional configuration object.
|
||||
*/
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
config: RootConfigService,
|
||||
options?: DatabaseManagerOptions,
|
||||
): DatabaseManager {
|
||||
const databaseConfig = config.getConfig('backend.database');
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
|
||||
import { Config } from '@backstage/config';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
DiscoveryService,
|
||||
RootConfigService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { readHttpServerOptions } from '../rootHttpRouter/http/config';
|
||||
|
||||
type Target = string | { internal: string; external: string };
|
||||
@@ -55,7 +58,10 @@ export class HostDiscovery implements DiscoveryService {
|
||||
* The basePath defaults to `/api`, meaning the default full internal
|
||||
* path for the `catalog` plugin will be `http://localhost:7007/api/catalog`.
|
||||
*/
|
||||
static fromConfig(config: Config, options?: { basePath?: string }) {
|
||||
static fromConfig(
|
||||
config: RootConfigService,
|
||||
options?: { basePath?: string },
|
||||
) {
|
||||
const basePath = options?.basePath ?? '/api';
|
||||
const externalBaseUrl = config
|
||||
.getString('backend.baseUrl')
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { LoggerService, UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { Config } from '@backstage/config';
|
||||
import {
|
||||
LoggerService,
|
||||
RootConfigService,
|
||||
UrlReaderService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { ReaderFactory } from './types';
|
||||
import { UrlReaderPredicateMux } from './UrlReaderPredicateMux';
|
||||
import { AzureUrlReader } from './AzureUrlReader';
|
||||
@@ -40,7 +43,7 @@ import { HarnessUrlReader } from './HarnessUrlReader';
|
||||
*/
|
||||
export type UrlReadersOptions = {
|
||||
/** Root config object */
|
||||
config: Config;
|
||||
config: RootConfigService;
|
||||
/** Logger used by all the readers */
|
||||
logger: LoggerService;
|
||||
/** A list of factories used to construct individual readers that match on URLs */
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
|
||||
import { Readable } from 'stream';
|
||||
import { Config } from '@backstage/config';
|
||||
import {
|
||||
UrlReaderService,
|
||||
UrlReaderServiceReadTreeResponse,
|
||||
LoggerService,
|
||||
RootConfigService,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ export type UrlReaderPredicateTuple = {
|
||||
* @public
|
||||
*/
|
||||
export type ReaderFactory = (options: {
|
||||
config: Config;
|
||||
config: RootConfigService;
|
||||
logger: LoggerService;
|
||||
treeResponseFactory: ReadTreeResponseFactory;
|
||||
}) => UrlReaderPredicateTuple[];
|
||||
|
||||
Reference in New Issue
Block a user