Add proxyEndpointsExtensionPoint

Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
Matt Benson
2024-10-18 14:09:51 -05:00
parent 41ab5cf4a0
commit 11b001cf4d
14 changed files with 235 additions and 1 deletions
+28
View File
@@ -15,7 +15,35 @@
*/
import { createBackend } from '@backstage/backend-defaults';
import { createBackendModule } from '@backstage/backend-plugin-api';
import { proxyEndpointsExtensionPoint } from '@backstage/plugin-proxy-node/alpha';
const backend = createBackend();
backend.add(import('../src/alpha'));
backend.add(
createBackendModule({
pluginId: 'proxy',
moduleId: 'demo-additional-endpoints',
register: reg => {
reg.registerInit({
deps: {
proxyEndpoints: proxyEndpointsExtensionPoint,
},
init: async ({ proxyEndpoints }) => {
proxyEndpoints.addProxyEndpoints({
...Object.fromEntries(
['foo', 'bar', 'baz'].map(msv => [
`/${msv}`,
{ target: `http://${msv}.org` },
]),
),
'/gocd': 'http://cannot-override-config.no',
});
},
});
},
}),
);
backend.start();