config: suppress unused warnings for all fields in embedded route envoy options (#5330)

This commit is contained in:
Joe Kralicky 2024-10-22 16:46:22 -04:00 committed by GitHub
parent 298a5a94a5
commit 1ccaf1b22b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,10 @@
package config
import (
"fmt"
"regexp"
clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
)
// KeyAction defines the Pomerium behavior when it encounters a deprecated config field
@ -39,14 +42,20 @@ var (
}
ignoreConfigFields = map[string]struct{}{
// mapstructure has issues with embedded protobuf structs that we should ignore
"routes.outlier_detection": {},
"routes.health_checks": {},
// set_response_headers is handled separately from mapstructure
"set_response_headers": {},
}
)
func init() {
// mapstructure has issues with embedded protobuf structs that we should ignore
envoyOptsFields := (*clusterv3.Cluster)(nil).ProtoReflect().Descriptor().Fields()
for i := range envoyOptsFields.Len() {
field := envoyOptsFields.Get(i)
ignoreConfigFields[fmt.Sprintf("routes.%s", field.Name())] = struct{}{}
}
}
// FieldMsg returns information
type FieldMsg struct {
Key string