Clusters : port 8006 par défaut, liste des cibles jamais null
This commit is contained in:
1 parent
8dd2f187ee
commit
ee8343c69f
5 files changed
+50
-3
No files matched your search
@@ -216,3 +216,15 @@ func (c *Config) HasKind(k model.Kind) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// NormalizeURL trims the URL of a cluster and adds the PVE port (8006) when
|
||||
// none is given: https://pve1 becomes https://pve1:8006.
|
||||
func NormalizeURL(raw string) string {
|
||||
s := strings.TrimRight(strings.TrimSpace(raw), "/")
|
||||
u, err := url.Parse(s)
|
||||
if err != nil || u.Host == "" || u.Port() != "" {
|
||||
return s
|
||||
}
|
||||
u.Host = net.JoinHostPort(u.Hostname(), "8006")
|
||||
return u.String()
|
||||
}
|
||||
Reference in new issue
Block a user