Skip to content

Commit

Permalink
chore: Disable introspection already in the server, drop obsolete mid…
Browse files Browse the repository at this point in the history
…dleware (#72)
  • Loading branch information
carstendietrich authored Jul 13, 2023
1 parent a2dabe9 commit dcbd7df
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions module.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package graphql

import (
"context"
"time"

"flamingo.me/dingo"
Expand Down Expand Up @@ -96,23 +95,21 @@ func (r *routes) Routes(registry *web.RouterRegistry) {
})
srv.SetQueryCache(lru.New(1000))

srv.Use(extension.Introspection{})
srv.Use(extension.AutomaticPersistedQuery{
Cache: lru.New(100),
})

if r.introspectionEnabled {
srv.Use(extension.Introspection{})
}

if r.openCensusTracingEnabled {
srv.Use(&OpenCensusTracingExtension{})
}

return srv
}(r.exec)

gqlHandler.AroundOperations(func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler {
graphql.GetOperationContext(ctx).DisableIntrospection = !r.introspectionEnabled
return next(ctx)
})

for _, middleware := range r.operationMiddlewares {
gqlHandler.AroundOperations(middleware)
}
Expand Down

0 comments on commit dcbd7df

Please sign in to comment.