Autogen the Origin of the log and use it to replace the hardcoded ct.ipng.ch strings in gen-html and gen-env

This commit is contained in:
Pim van Pelt
2025-08-28 20:52:08 +02:00
parent 6b11481739
commit 0503370489
4 changed files with 14 additions and 8 deletions

View File

@@ -151,14 +151,10 @@ func extractPort(listenAddr string) string {
}
func extractHostname(urlStr string) (string, error) {
if !strings.HasPrefix(urlStr, "http://") && !strings.HasPrefix(urlStr, "https://") {
urlStr = "https://" + urlStr
}
parsedURL, err := url.Parse(urlStr)
if err != nil {
return "", err
}
return parsedURL.Hostname(), nil
return parsedURL.Host, nil
}