strongly type proxyConfig
Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
@@ -49,11 +49,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/types": "workspace:^"
|
||||
"http-proxy-middleware": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/backend-test-utils": "workspace:^",
|
||||
"@backstage/cli": "workspace:^",
|
||||
"@backstage/config": "workspace:^"
|
||||
"@backstage/config": "workspace:^",
|
||||
"@types/http-proxy-middleware": "^1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,24 @@
|
||||
|
||||
```ts
|
||||
import { ExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Options } from 'http-proxy-middleware';
|
||||
|
||||
// @alpha
|
||||
export interface ProxyConfig extends Options {
|
||||
// (undocumented)
|
||||
allowedHeaders?: string[];
|
||||
// (undocumented)
|
||||
allowedMethods?: string[];
|
||||
// (undocumented)
|
||||
credentials?: 'require' | 'forward' | 'dangerously-allow-unauthenticated';
|
||||
// (undocumented)
|
||||
reviveRequestBody?: boolean;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export interface ProxyEndpointsExtensionPoint {
|
||||
// (undocumented)
|
||||
addProxyEndpoints(endpoints: JsonObject): void;
|
||||
addProxyEndpoints(endpoints: Record<string, string | ProxyConfig>): void;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
|
||||
@@ -14,7 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { createExtensionPoint } from '@backstage/backend-plugin-api';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Options } from 'http-proxy-middleware';
|
||||
|
||||
/**
|
||||
* http-proxy-middleware proxy config interface.
|
||||
*
|
||||
* @alpha
|
||||
*/
|
||||
export interface ProxyConfig extends Options {
|
||||
allowedMethods?: string[];
|
||||
allowedHeaders?: string[];
|
||||
reviveRequestBody?: boolean;
|
||||
credentials?: 'require' | 'forward' | 'dangerously-allow-unauthenticated';
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension point interface for managing proxy endpoints.
|
||||
@@ -22,7 +34,7 @@ import { JsonObject } from '@backstage/types';
|
||||
* @alpha
|
||||
*/
|
||||
export interface ProxyEndpointsExtensionPoint {
|
||||
addProxyEndpoints(endpoints: JsonObject): void;
|
||||
addProxyEndpoints(endpoints: Record<string, string | ProxyConfig>): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user