split node context in its own module

This commit is contained in:
Jesse de Wit
2023-11-06 15:00:34 +01:00
parent f6af1e5442
commit 4be6d8c6a4
3 changed files with 41 additions and 31 deletions

View File

@@ -29,11 +29,6 @@ type grpcServer struct {
n notifications.NotificationsServer
}
type nodeContext struct {
token string
node *common.Node
}
func NewGrpcServer(
nodesService common.NodesService,
address string,
@@ -84,10 +79,7 @@ func (s *grpcServer) Start() error {
continue
}
return handler(context.WithValue(ctx, contextKey("node"), &nodeContext{
token: token,
node: node,
}), req)
return handler(lspdrpc.WithNode(ctx, node, token), req)
}
}
return nil, status.Errorf(codes.PermissionDenied, "Not authorized")