verify Site.URL on start-up

This commit is contained in:
Azareal 2020-08-13 09:46:10 +10:00
parent 62be4020d6
commit 9fd88bd6bc
1 changed files with 5 additions and 1 deletions

View File

@ -199,6 +199,10 @@ func ProcessConfig() (err error) {
Site.URL = strings.TrimSuffix(Site.URL, ":") Site.URL = strings.TrimSuffix(Site.URL, ":")
Site.URL = Site.URL + ":" + Site.Port Site.URL = Site.URL + ":" + Site.Port
} }
uurl, err := url.Parse(Site.URL)
if err != nil {
return errors.Wrap(err, "failed to parse Site.URL: ")
}
if Site.EnableSsl { if Site.EnableSsl {
Config.SslSchema = Site.EnableSsl Config.SslSchema = Site.EnableSsl
} }
@ -237,7 +241,7 @@ func ProcessConfig() (err error) {
local := func(h string) bool { local := func(h string) bool {
return h == "localhost" || h == "127.0.0.1" || h == "::1" || h == Site.URL return h == "localhost" || h == "127.0.0.1" || h == "::1" || h == Site.URL
} }
uurl, err := url.Parse(Config.StaticResBase) uurl, err = url.Parse(Config.StaticResBase)
if err != nil { if err != nil {
return errors.Wrap(err, "failed to parse Config.StaticResBase: ") return errors.Wrap(err, "failed to parse Config.StaticResBase: ")
} }