Seperate elements in NoTLSRedirectLocations by comma
This commit is contained in:
parent
467ff9924c
commit
b727e1aeb4
3 changed files with 10 additions and 10 deletions
|
@ -487,8 +487,8 @@ type Configuration struct {
|
|||
// SyslogPort port
|
||||
SyslogPort int `json:"syslog-port",omitempty`
|
||||
|
||||
// NoTLSRedirectLocations is a "\n -" seperated list of locations
|
||||
// that shall not get redirected to tls
|
||||
// NoTLSRedirectLocations is a comma-seperated list of locations
|
||||
// that should not get redirected to TLS
|
||||
NoTLSRedirectLocations string `json:"no-tls-redirect-locations"`
|
||||
}
|
||||
|
||||
|
|
|
@ -515,10 +515,10 @@ func isLocationInLocationList(location interface{}, rawLocationList string) bool
|
|||
return false
|
||||
}
|
||||
|
||||
locationList := strings.Split(rawLocationList, "\n- ")
|
||||
locationList := strings.Split(rawLocationList, ",")
|
||||
|
||||
for _, locationListItem := range locationList {
|
||||
locationListItem = strings.TrimLeft(locationListItem, "- ")
|
||||
locationListItem = strings.Trim(locationListItem, " ")
|
||||
if locationListItem == "" {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -462,12 +462,12 @@ func TestIsLocationInLocationList(t *testing.T) {
|
|||
rawLocationList string
|
||||
expected bool
|
||||
}{
|
||||
{&ingress.Location{Path: "/match"}, "- /match", true},
|
||||
{&ingress.Location{Path: "/match"}, "\n- /match", true},
|
||||
{&ingress.Location{Path: "/match"}, "- /dontmatch", false},
|
||||
{&ingress.Location{Path: "/match"}, "\n- /dontmatch", false},
|
||||
{&ingress.Location{Path: "/match"}, "- /dontmatch\n- /match", true},
|
||||
{&ingress.Location{Path: "/match"}, "\n- /dontmatch\n- /dontmatcheither", false},
|
||||
{&ingress.Location{Path: "/match"}, "/match", true},
|
||||
{&ingress.Location{Path: "/match"}, ",/match", true},
|
||||
{&ingress.Location{Path: "/match"}, "/dontmatch", false},
|
||||
{&ingress.Location{Path: "/match"}, ",/dontmatch", false},
|
||||
{&ingress.Location{Path: "/match"}, "/dontmatch,/match", true},
|
||||
{&ingress.Location{Path: "/match"}, "/dontmatch,/dontmatcheither", false},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
|
Loading…
Reference in a new issue