diff --git a/.changeset/six-humans-guess.md b/.changeset/six-humans-guess.md new file mode 100644 index 0000000000..60845257c8 --- /dev/null +++ b/.changeset/six-humans-guess.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-proxy-backend': patch +--- + +Deprecated `createRouter` and its router options in favour of the new backend system. diff --git a/plugins/proxy-backend/api-report.md b/plugins/proxy-backend/api-report.md index 12e6bfa1c9..9e1b5087f1 100644 --- a/plugins/proxy-backend/api-report.md +++ b/plugins/proxy-backend/api-report.md @@ -3,20 +3,20 @@ > 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 express from 'express'; import { Logger } from 'winston'; -import { PluginEndpointDiscovery } from '@backstage/backend-common'; +import { RootConfigService } from '@backstage/backend-plugin-api'; -// @public +// @public @deprecated export function createRouter(options: RouterOptions): Promise; -// @public (undocumented) +// @public @deprecated (undocumented) export interface RouterOptions { // (undocumented) - config: Config; + config: RootConfigService; // (undocumented) - discovery: PluginEndpointDiscovery; + discovery: DiscoveryService; // (undocumented) logger: Logger; // (undocumented) diff --git a/plugins/proxy-backend/src/service/router.ts b/plugins/proxy-backend/src/service/router.ts index 6a513678f0..9ea064ea55 100644 --- a/plugins/proxy-backend/src/service/router.ts +++ b/plugins/proxy-backend/src/service/router.ts @@ -25,9 +25,12 @@ import { } from 'http-proxy-middleware'; import { Logger } from 'winston'; import http from 'http'; -import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { JsonObject } from '@backstage/types'; -import { HttpRouterService } from '@backstage/backend-plugin-api'; +import { + DiscoveryService, + HttpRouterService, + RootConfigService, +} from '@backstage/backend-plugin-api'; // A list of headers that are always forwarded to the proxy targets. const safeForwardHeaders = [ @@ -50,11 +53,14 @@ const safeForwardHeaders = [ 'user-agent', ]; -/** @public */ +/** + * @public + * @deprecated Please migrate to the new backend system as this will be removed in the future. + */ export interface RouterOptions { logger: Logger; - config: Config; - discovery: PluginEndpointDiscovery; + config: RootConfigService; + discovery: DiscoveryService; skipInvalidProxies?: boolean; reviveConsumedRequestBodies?: boolean; } @@ -278,6 +284,7 @@ function readProxyConfig(config: Config, logger: Logger): JsonObject { * * @see https://backstage.io/docs/plugins/proxying * @public + * @deprecated Please migrate to the new backend system as this will be removed in the future. */ export async function createRouter( options: RouterOptions,