Skip to content

Commit

Permalink
feat(commons,router): add routerName string arg to grpcToConduitRoute()
Browse files Browse the repository at this point in the history
  • Loading branch information
kon14 committed Nov 29, 2021
1 parent 8778182 commit decb592
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/commons/src/utilities/GrpcConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function getDescriptor(protofile: string): any {
}

export function grpcToConduitRoute(
routerName: string,
request: any,
moduleName?: string
): (ConduitRoute | ConduitMiddleware | ConduitSocket)[] {
Expand All @@ -39,7 +40,7 @@ export function grpcToConduitRoute(

let routerDescriptor: any = getDescriptor(request.protoFile);
//this can break everything change it
while (Object.keys(routerDescriptor)[0] !== 'Router') {
while (Object.keys(routerDescriptor)[0] !== routerName) {
routerDescriptor = routerDescriptor[Object.keys(routerDescriptor)[0]];
}
routerDescriptor = routerDescriptor[Object.keys(routerDescriptor)[0]];
Expand Down
1 change: 1 addition & 0 deletions packages/router/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export class ConduitDefaultRouter implements IConduitRouter {
| ConduitMiddleware
| ConduitSocket
)[] = grpcToConduitRoute(
'Router',
{
protoFile: protofile,
routes: routes,
Expand Down

0 comments on commit decb592

Please sign in to comment.