Skip to content
Snippets Groups Projects
Commit 34002983 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-6668 OZG-7019 add client name to grpc calls' (#13)...

Merge pull request 'OZG-6668 OZG-7019 add client name to grpc calls' (#13) from OZG-6668-add-cient-name-to-grpc-calls into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/fachstellen-proxy/pulls/13


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents 873cc465 07a613b6
Branches
Tags
No related merge requests found
...@@ -40,6 +40,9 @@ import ( ...@@ -40,6 +40,9 @@ import (
"net" "net"
) )
const keyClientName = "CLIENT_NAME-bin"
const clientName = "FachstellenServer"
type collaborationRouter struct { type collaborationRouter struct {
pb.UnimplementedCollaborationServiceServer pb.UnimplementedCollaborationServiceServer
} }
...@@ -57,6 +60,7 @@ func (s *collaborationRouter) FindVorgang(ctx context.Context, in *pb.GrpcFindVo ...@@ -57,6 +60,7 @@ func (s *collaborationRouter) FindVorgang(ctx context.Context, in *pb.GrpcFindVo
} }
func (s *collaborationRouter) handleRequest(ctx context.Context, handler func(pb.CollaborationServiceClient, context.Context) (interface{}, error)) (interface{}, error) { func (s *collaborationRouter) handleRequest(ctx context.Context, handler func(pb.CollaborationServiceClient, context.Context) (interface{}, error)) (interface{}, error) {
ctx = metadata.AppendToOutgoingContext(ctx, keyClientName, clientName)
md, ok := metadata.FromIncomingContext(ctx) md, ok := metadata.FromIncomingContext(ctx)
if !ok { if !ok {
return nil, status.Error(codes.InvalidArgument, "unable to retrieve metadata") return nil, status.Error(codes.InvalidArgument, "unable to retrieve metadata")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment