Commit 3a04d2a3 authored by John Belamaric's avatar John Belamaric Committed by Miek Gieben

Changes needed to support external gRPC server middleware (#498)

The gRPC server middleware[1] needs access to the Server object
in order to push the unpacked Msg through the normal middleware
pipeline. These are the changes to core needed to make that
possible.

[1] https://github.com/infobloxopen/coredns-grpc
parent 439d8b8d
...@@ -21,6 +21,9 @@ type Config struct { ...@@ -21,6 +21,9 @@ type Config struct {
// First consumer is the file middleware to looks for zone files in this place. // First consumer is the file middleware to looks for zone files in this place.
Root string Root string
// Server is the server that handles this config
Server *Server
// Middleware stack. // Middleware stack.
Middleware []middleware.Middleware Middleware []middleware.Middleware
......
...@@ -67,6 +67,7 @@ func NewServer(addr string, group []*Config) (*Server, error) { ...@@ -67,6 +67,7 @@ func NewServer(addr string, group []*Config) (*Server, error) {
stack = site.Middleware[i](stack) stack = site.Middleware[i](stack)
} }
site.middlewareChain = stack site.middlewareChain = stack
site.Server = s
} }
return s, nil return s, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment