git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #431 from ploxiln/nil_upstream_url
23cef89Jehiah Czebotar
options.go+8−8
@@ -131,7 +131,8 @@ func (o *Options) Validate() error {
131 msgs = append(msgs, "missing setting: client-secret")
131 msgs = append(msgs, "missing setting: client-secret")
132 }
132 }
133 if o.AuthenticatedEmailsFile == "" && len(o.EmailDomains) == 0 && o.HtpasswdFile == "" {
133 if o.AuthenticatedEmailsFile == "" && len(o.EmailDomains) == 0 && o.HtpasswdFile == "" {
134− msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required.\n use email-domain=* to authorize all email addresses")
134+ msgs = append(msgs, "missing setting for email validation: email-domain or authenticated-emails-file required."+
135+ "\n use email-domain=* to authorize all email addresses")
135 }
136 }
136
137
137 o.redirectURL, msgs = parseURL(o.RedirectURL, "redirect", msgs)
138 o.redirectURL, msgs = parseURL(o.RedirectURL, "redirect", msgs)
@@ -139,14 +140,13 @@ func (o *Options) Validate() error {
139 for _, u := range o.Upstreams {
140 for _, u := range o.Upstreams {
140 upstreamURL, err := url.Parse(u)
141 upstreamURL, err := url.Parse(u)
141 if err != nil {
142 if err != nil {
142− msgs = append(msgs, fmt.Sprintf(
143+ msgs = append(msgs, fmt.Sprintf("error parsing upstream: %s", err))
143− "error parsing upstream=%q %s",
144+ } else {
144− upstreamURL, err))
145− }
146− if upstreamURL.Path == "" {
145+ if upstreamURL.Path == "" {
147− upstreamURL.Path = "/"
146+ upstreamURL.Path = "/"
147+ }
148+ o.proxyURLs = append(o.proxyURLs, upstreamURL)
148 }
149 }
149− o.proxyURLs = append(o.proxyURLs, upstreamURL)
150 }
150 }
151
151
152 for _, u := range o.SkipAuthRegex {
152 for _, u := range o.SkipAuthRegex {