mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-30 10:56:28 +02:00
config: suppress unused warnings for all fields in embedded route envoy options (#5330)
This commit is contained in:
parent
298a5a94a5
commit
1ccaf1b22b
1 changed files with 12 additions and 3 deletions
|
@ -1,7 +1,10 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
|
clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KeyAction defines the Pomerium behavior when it encounters a deprecated config field
|
// KeyAction defines the Pomerium behavior when it encounters a deprecated config field
|
||||||
|
@ -39,14 +42,20 @@ var (
|
||||||
}
|
}
|
||||||
|
|
||||||
ignoreConfigFields = map[string]struct{}{
|
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 is handled separately from mapstructure
|
||||||
"set_response_headers": {},
|
"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
|
// FieldMsg returns information
|
||||||
type FieldMsg struct {
|
type FieldMsg struct {
|
||||||
Key string
|
Key string
|
||||||
|
|
Loading…
Add table
Reference in a new issue