2023-11-23 19:56:48 +00:00
|
|
|
package configure
|
|
|
|
|
|
|
|
import (
|
2025-01-07 10:49:23 +00:00
|
|
|
"errors"
|
2023-11-23 19:56:48 +00:00
|
|
|
"net/url"
|
|
|
|
)
|
|
|
|
|
|
|
|
func validateHost(s string) error {
|
|
|
|
u, err := url.Parse(s)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if u.Host == "" || u.Scheme != "https" {
|
2025-01-07 10:49:23 +00:00
|
|
|
return errors.New("must start with https://")
|
2023-11-23 19:56:48 +00:00
|
|
|
}
|
|
|
|
if u.Path != "" && u.Path != "/" {
|
2025-01-07 10:49:23 +00:00
|
|
|
return errors.New("must use empty path")
|
2023-11-23 19:56:48 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|