mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-22 08:48:43 +02:00
fixed host set to localhost even on remote docker, fixed one error in provider causing all routes not to load
This commit is contained in:
@@ -20,9 +20,23 @@ type Client struct {
|
||||
l logrus.FieldLogger
|
||||
}
|
||||
|
||||
func ParseDockerHostname(host string) (string, E.NestedError) {
|
||||
if host == common.DockerHostFromEnv {
|
||||
return host, nil
|
||||
} else if host == "" {
|
||||
return "localhost", nil
|
||||
}
|
||||
url, err := E.Check(client.ParseHostURL(host))
|
||||
if err != nil {
|
||||
return "", E.Invalid("host", host).With(err)
|
||||
}
|
||||
return url.Hostname(), nil
|
||||
}
|
||||
|
||||
func (c Client) DaemonHostname() string {
|
||||
url, _ := client.ParseHostURL(c.DaemonHost())
|
||||
return url.Hostname()
|
||||
// DaemonHost should always return a valid host
|
||||
hostname, _ := ParseDockerHostname(c.DaemonHost())
|
||||
return hostname
|
||||
}
|
||||
|
||||
func (c Client) Connected() bool {
|
||||
|
||||
Reference in New Issue
Block a user