git.iko.soy/typeable/oauth2-proxy
on master help sign in
options: gracefully report un-parsed upstream URL

upstreamURL is a nil pointer if there is an error parsing --upstream

commite9bbecfacecbccc08f359f2f2ee3f13d5e4e0c70 authorPierce Lopez <pierce.lopez@gmail.com> dateSat 5 Aug 2017, 12:48 (9 years ago) parent3c51c91
1 file changed+6−7
options.go+6−7
options.go+6−7
@@ -142,14 +142,13 @@ func (o *Options) Validate() error {
142142 for _, u := range o.Upstreams {
143143 upstreamURL, err := url.Parse(u)
144144 if err != nil {
145− msgs = append(msgs, fmt.Sprintf(
146− "error parsing upstream=%q %s",
147− upstreamURL, err))
148− }
149− if upstreamURL.Path == "" {
150− upstreamURL.Path = "/"
145+ msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
146+ } else {
147+ if upstreamURL.Path == "" {
148+ upstreamURL.Path = "/"
149+ }
150+ o.proxyURLs = append(o.proxyURLs, upstreamURL)
151151 }
152− o.proxyURLs = append(o.proxyURLs, upstreamURL)
153152 }
154153
155154 for _, u := range o.SkipAuthRegex {