From 847a6dd6507640688b3348cf4be6d7776a710a3a Mon Sep 17 00:00:00 2001 From: Daniel Upton Date: Wed, 21 Sep 2022 11:44:58 +0100 Subject: [PATCH] Use SupportsDataplaneFeatures helper --- pkg/consuldp/consul_dataplane.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/consuldp/consul_dataplane.go b/pkg/consuldp/consul_dataplane.go index b65ada75..aaace552 100644 --- a/pkg/consuldp/consul_dataplane.go +++ b/pkg/consuldp/consul_dataplane.go @@ -108,14 +108,9 @@ func (cdp *ConsulDataplane) Run(ctx context.Context) error { ServerWatchDisabled: cdp.cfg.Consul.ServerWatchDisabled, Credentials: creds, TLS: tls, - ServerEvalFn: func(state discovery.State) bool { - // We require support for generating Envoy bootstrap configuration at least. - // - // TODO: now that we consume Consul's protobufs as a Go module, should we - // have the discovery package expose the protobuf enum type rather than the - // string representation? - return state.DataplaneFeatures[pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_ENVOY_BOOTSTRAP_CONFIGURATION.String()] - }, + ServerEvalFn: discovery.SupportsDataplaneFeatures( + pbdataplane.DataplaneFeatures_DATAPLANE_FEATURES_ENVOY_BOOTSTRAP_CONFIGURATION.String(), + ), }, cdp.logger.Named("server-connection-manager")) if err != nil { return err