config: support multiple destination addresses (#1789)

* config: support multiple destination addresses

* use constructor for string slice

* add docs

* add test for multiple destinations

* fix name
This commit is contained in:
Caleb Doxsey 2021-01-20 15:18:24 -07:00 committed by GitHub
parent c6b6141d12
commit a4c7381eba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 556 additions and 191 deletions

View file

@ -404,8 +404,8 @@ func getRewriteOptions(policy *config.Policy) (prefixRewrite string, regexRewrit
},
Substitution: policy.RegexRewriteSubstitution,
}
} else if policy.Destination != nil && policy.Destination.Path != "" {
prefixRewrite = policy.Destination.Path
} else if len(policy.Destinations) > 0 && policy.Destinations[0].Path != "" {
prefixRewrite = policy.Destinations[0].Path
}
return prefixRewrite, regexRewrite
@ -460,3 +460,11 @@ func mustParseURL(str string) *url.URL {
}
return u
}
func mustParseURLs(strs ...string) []*url.URL {
var us []*url.URL
for _, str := range strs {
us = append(us, mustParseURL(str))
}
return us
}