make async and readonly
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
committed by
Fredrik Adelöw
parent
92f5823498
commit
6cf2ba39d9
@@ -38,11 +38,11 @@ export const gatewayPlugin = createBackendPlugin({
|
||||
async init({ logger, discovery, instanceMeta, rootHttpRouter }) {
|
||||
rootHttpRouter.use(
|
||||
'/api/:pluginId',
|
||||
createRouter({
|
||||
(await createRouter({
|
||||
discovery,
|
||||
instanceMeta,
|
||||
logger,
|
||||
}) as Handler,
|
||||
})) as Handler,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ import { createProxyMiddleware } from 'http-proxy-middleware';
|
||||
import { context } from '@opentelemetry/api';
|
||||
import { getRPCMetadata } from '@opentelemetry/core';
|
||||
|
||||
export function createRouter({
|
||||
export async function createRouter({
|
||||
discovery,
|
||||
instanceMeta,
|
||||
}: {
|
||||
@@ -31,9 +31,8 @@ export function createRouter({
|
||||
instanceMeta: InstanceMetadataService;
|
||||
logger: LoggerService;
|
||||
}) {
|
||||
const localPluginIds = new Set(
|
||||
instanceMeta.getInstalledPlugins().map(f => f.pluginId),
|
||||
);
|
||||
const plugins = await instanceMeta.getInstalledPlugins();
|
||||
const localPluginIds = new Set(plugins.map(f => f.pluginId));
|
||||
|
||||
const proxy = createProxyMiddleware({
|
||||
changeOrigin: true,
|
||||
|
||||
Reference in New Issue
Block a user