Commit 0b1fad47 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Add extra values to API explorer request contexts.

parent 4d51bee3
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import (
	"reflect"
	"sort"
	"strings"
	"time"
)

type MethodName string
@@ -135,10 +136,12 @@ func (s *ConsoleServer) extractApiCallContext(ctx context.Context, in *console.C
			s.logger.Error("Error looking up user account.", zap.String("method", in.Method), zap.Error(err))
			return nil, status.Error(codes.Internal, "Error looking up user account.")
		}
		callCtx = context.WithValue(context.WithValue(ctx, ctxUserIDKey{}, userUUID), ctxUsernameKey{}, dbUsername)
		callCtx = context.WithValue(ctx, ctxUserIDKey{}, userUUID)
		callCtx = context.WithValue(callCtx, ctxUsernameKey{}, dbUsername)
		callCtx = context.WithValue(callCtx, ctxVarsKey{}, map[string]string{})
		callCtx = context.WithValue(callCtx, ctxExpiryKey{}, time.Now().Add(24*time.Hour).Unix())
	}
	return callCtx, nil

}

func (s *ConsoleServer) ListApiEndpoints(ctx context.Context, _ *empty.Empty) (*console.ApiEndpointList, error) {