mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Do not register API Middleware with validator gateway (#9055)
* Do not register API Middleware with validator gateway * add nil checker * revert bool * nil check Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
4d1b5f42af
commit
fbed11b380
@ -9,6 +9,10 @@ import (
|
||||
type BeaconEndpointFactory struct {
|
||||
}
|
||||
|
||||
func (f *BeaconEndpointFactory) IsNil() bool {
|
||||
return f == nil
|
||||
}
|
||||
|
||||
// Paths is a collection of all valid beacon chain API paths.
|
||||
func (f *BeaconEndpointFactory) Paths() []string {
|
||||
return []string{
|
||||
|
@ -23,6 +23,7 @@ type ApiProxyMiddleware struct {
|
||||
type EndpointFactory interface {
|
||||
Create(path string) (*Endpoint, error)
|
||||
Paths() []string
|
||||
IsNil() bool
|
||||
}
|
||||
|
||||
// Endpoint is a representation of an API HTTP endpoint that should be proxied by the middleware.
|
||||
|
@ -231,7 +231,9 @@ func (g *Gateway) Start() {
|
||||
}
|
||||
}()
|
||||
|
||||
go g.registerApiMiddleware()
|
||||
if g.apiMiddlewareAddr != "" && g.apiMiddlewareEndpointFactory != nil && !g.apiMiddlewareEndpointFactory.IsNil() {
|
||||
go g.registerApiMiddleware()
|
||||
}
|
||||
}
|
||||
|
||||
// Status of grpc gateway. Returns an error if this service is unhealthy.
|
||||
|
@ -81,6 +81,7 @@ func TestValidatorGateway_StartStop(t *testing.T) {
|
||||
validatorGateway.Start()
|
||||
go func() {
|
||||
require.LogsContain(t, hook, "Starting gRPC gateway")
|
||||
require.LogsDoNotContain(t, hook, "Starting API middleware")
|
||||
}()
|
||||
|
||||
err := validatorGateway.Stop()
|
||||
|
Loading…
Reference in New Issue
Block a user