From d56781c3dfca5ec9cce566d6edd17f4e9b4ceb51 Mon Sep 17 00:00:00 2001 From: Kyle Ellrott Date: Tue, 24 Oct 2023 16:15:44 -0700 Subject: [PATCH] Adding ability to write to plugin endpoints --- server/server.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/server.go b/server/server.go index 041f6b05..a693efa7 100644 --- a/server/server.go +++ b/server/server.go @@ -218,11 +218,18 @@ func (server *GripServer) Serve(pctx context.Context) error { */ for name, setup := range endpointMap { - handler, err := setup(gripql.WrapClient(gripql.NewQueryDirectClient( + queryClient := gripql.NewQueryDirectClient( server, gripql.DirectUnaryInterceptor(unaryAuthInt), gripql.DirectStreamInterceptor(streamAuthInt), - ), nil, nil, nil)) + ) + // TODO: make writeClient initialization configurable + writeClient := gripql.NewEditDirectClient( + server, + gripql.DirectUnaryInterceptor(unaryAuthInt), + gripql.DirectStreamInterceptor(streamAuthInt), + ) + handler, err := setup(gripql.WrapClient(queryClient, writeClient, nil, nil)) if err == nil { log.Infof("Plugin added to /%s/", name) prefix := fmt.Sprintf("/%s/", name)