Merge pull request #14061 from agentbellnorm/pass-catalog-client-to-techdocs-router
[TechDocs] Pass catalog client to techdocs router
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-backend': minor
|
||||
---
|
||||
|
||||
Add optional `catalogClient` argument to `createRoute` parameters
|
||||
@@ -6,6 +6,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { Config } from '@backstage/config';
|
||||
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
@@ -79,6 +80,7 @@ export type OutOfTheBoxDeploymentOptions = {
|
||||
cache: PluginCacheManager;
|
||||
docsBuildStrategy?: DocsBuildStrategy;
|
||||
buildLogTransport?: winston.transport;
|
||||
catalogClient?: CatalogClient;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -90,6 +92,7 @@ export type RecommendedDeploymentOptions = {
|
||||
cache: PluginCacheManager;
|
||||
docsBuildStrategy?: DocsBuildStrategy;
|
||||
buildLogTransport?: winston.transport;
|
||||
catalogClient?: CatalogClient;
|
||||
};
|
||||
|
||||
// @public
|
||||
|
||||
@@ -58,6 +58,7 @@ export type OutOfTheBoxDeploymentOptions = {
|
||||
cache: PluginCacheManager;
|
||||
docsBuildStrategy?: DocsBuildStrategy;
|
||||
buildLogTransport?: winston.transport;
|
||||
catalogClient?: CatalogClient;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -74,6 +75,7 @@ export type RecommendedDeploymentOptions = {
|
||||
cache: PluginCacheManager;
|
||||
docsBuildStrategy?: DocsBuildStrategy;
|
||||
buildLogTransport?: winston.transport;
|
||||
catalogClient?: CatalogClient;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -107,7 +109,8 @@ export async function createRouter(
|
||||
): Promise<express.Router> {
|
||||
const router = Router();
|
||||
const { publisher, config, logger, discovery } = options;
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery });
|
||||
const catalogClient =
|
||||
options.catalogClient ?? new CatalogClient({ discoveryApi: discovery });
|
||||
const docsBuildStrategy =
|
||||
options.docsBuildStrategy ?? DefaultDocsBuildStrategy.fromConfig(config);
|
||||
const buildLogTransport =
|
||||
|
||||
Reference in New Issue
Block a user