-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
helper.go
30 lines (24 loc) · 923 Bytes
/
helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package config
import (
"net/url"
"github.com/ory/x/logrusx"
)
func MustValidate(l *logrusx.Logger, p *Provider) {
if publicTLS := p.TLS(PublicInterface); publicTLS.Enabled() {
if p.IssuerURL().String() == "" {
l.Fatalf(`Configuration key "%s" must be set unless flag "--dangerous-force-http" is set. To find out more, use "hydra help serve".`, KeyIssuerURL)
}
if p.IssuerURL().Scheme != "https" {
l.Fatalf(`Scheme from configuration key "%s" must be "https" unless --dangerous-force-http is passed but got scheme in value "%s" is "%s". To find out more, use "hydra help serve".`, KeyIssuerURL, p.IssuerURL().String(), p.IssuerURL().Scheme)
}
if len(p.InsecureRedirects()) > 0 {
l.Fatal(`Flag --dangerous-allow-insecure-redirect-urls can only be used in combination with flag --dangerous-force-http`)
}
}
}
func urlRoot(u *url.URL) *url.URL {
if u.Path == "" {
u.Path = "/"
}
return u
}