options: gracefully report un-parsed upstream URL
upstreamURL is a nil pointer if there is an error parsing --upstream
This commit is contained in:
parent
3c51c914ac
commit
e9bbecface
@ -142,15 +142,14 @@ func (o *Options) Validate() error {
|
||||
for _, u := range o.Upstreams {
|
||||
upstreamURL, err := url.Parse(u)
|
||||
if err != nil {
|
||||
msgs = append(msgs, fmt.Sprintf(
|
||||
"error parsing upstream=%q %s",
|
||||
upstreamURL, err))
|
||||
}
|
||||
msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
|
||||
} else {
|
||||
if upstreamURL.Path == "" {
|
||||
upstreamURL.Path = "/"
|
||||
}
|
||||
o.proxyURLs = append(o.proxyURLs, upstreamURL)
|
||||
}
|
||||
}
|
||||
|
||||
for _, u := range o.SkipAuthRegex {
|
||||
CompiledRegex, err := regexp.Compile(u)
|
||||
|
Loading…
Reference in New Issue
Block a user