1
0
Fork 0

Merge v2.10 into v3.0

This commit is contained in:
mmatur 2023-10-11 16:20:26 +02:00
commit 286181aa61
No known key found for this signature in database
GPG key ID: 2FFE42FC256CFF8E
62 changed files with 712 additions and 189 deletions

View file

@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"reflect"
"regexp"
"github.com/mitchellh/copystructure"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
@ -67,8 +66,7 @@ func do(baseConfig interface{}, tag string, redactByDefault, indent bool) (strin
}
func doOnJSON(input string) string {
mailExp := regexp.MustCompile(`\w[-.\w]*\w@\w[-.\w]*\w\.\w{2,3}"`)
return xurls.Relaxed().ReplaceAllString(mailExp.ReplaceAllString(input, maskLarge+"\""), maskLarge)
return xurls.Relaxed().ReplaceAllString(input, maskLarge)
}
func doOnStruct(field reflect.Value, tag string, redactByDefault bool) error {

View file

@ -45,13 +45,15 @@ func Test_doOnJSON_simple(t *testing.T) {
"URL": "foo domain.com foo",
"URL": "foo sub.domain.com foo",
"URL": "foo sub.sub.domain.com foo",
"URL": "foo sub.sub.sub.domain.com.us foo"
"URL": "foo sub.sub.sub.domain.com.us foo",
"URL":"https://hub.example.com","foo":"bar"
}`,
expectedOutput: `{
"URL": "foo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx foo",
"URL": "foo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx foo",
"URL": "foo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx foo",
"URL": "foo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx foo"
"URL": "foo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx foo",
"URL":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","foo":"bar"
}`,
},
}