mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
fix unused key warnings in routes (#3711)
This commit is contained in:
parent
3f9dfbef76
commit
d8f4355f66
1 changed files with 7 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -403,10 +404,15 @@ func optionsFromViper(configFile string) (*Options, error) {
|
|||
return o, nil
|
||||
}
|
||||
|
||||
var (
|
||||
// policy's embedded protobuf structs are decoded by separate hook and are unknown to mapstructure
|
||||
routesEmbeddedFieldsRe = regexp.MustCompile(`(routes|policy)\[\.*`)
|
||||
)
|
||||
|
||||
func checkUnusedConfigFields(configFile string, unused []string) {
|
||||
keys := make([]string, 0, len(unused))
|
||||
for _, k := range unused {
|
||||
if !strings.HasPrefix(k, "policy[") { // policy's embedded protobuf structs are decoded by separate hook and are unknown to mapstructure
|
||||
if !routesEmbeddedFieldsRe.MatchString(k) {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue