proxy-backend: Deprecate createRouter

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2024-08-20 11:24:13 +02:00
parent a0d830645a
commit d298e6ed88
3 changed files with 23 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-proxy-backend': patch
---
Deprecated `createRouter` and its router options in favour of the new backend system.
+6 -6
View File
@@ -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<express.Router>;
// @public (undocumented)
// @public @deprecated (undocumented)
export interface RouterOptions {
// (undocumented)
config: Config;
config: RootConfigService;
// (undocumented)
discovery: PluginEndpointDiscovery;
discovery: DiscoveryService;
// (undocumented)
logger: Logger;
// (undocumented)
+12 -5
View File
@@ -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,