Skip to content

Commit

Permalink
Merge pull request #298 from bmeg/writable-endpoint
Browse files Browse the repository at this point in the history
Adding ability to write to plugin endpoints
  • Loading branch information
kellrott authored Oct 26, 2023
2 parents 44878a8 + d56781c commit b0bb9c6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b0bb9c6

Please sign in to comment.