MCPcopy Create free account
hub / github.com/nginx-proxy/docker-gen / GetEndpoint

Function GetEndpoint

internal/dockerclient/docker_cli.go:14–30  ·  view source on GitHub ↗
(endpoint string)

Source from the content-addressed store, hash-verified

12)
13
14func GetEndpoint(endpoint string) (string, error) {
15 defaultEndpoint := "unix:///var/run/docker.sock"
16 if os.Getenv("DOCKER_HOST") != "" {
17 defaultEndpoint = os.Getenv("DOCKER_HOST")
18 }
19
20 if endpoint != "" {
21 defaultEndpoint = endpoint
22 }
23
24 _, _, err := parseHost(defaultEndpoint)
25 if err != nil {
26 return "", err
27 }
28
29 return defaultEndpoint, nil
30}
31
32func NewDockerClient(endpoint string, tlsVerify bool, tlsCert, tlsCaCert, tlsKey string) (*docker.Client, error) {
33 if strings.HasPrefix(endpoint, "unix:") {

Callers 6

NewGeneratorFunction · 0.92
generateFromEventsMethod · 0.92
TestDefaultEndpointFunction · 0.85
TestDockerHostEndpointFunction · 0.85
TestDockerFlagEndpointFunction · 0.85
TestUnixBadFormatFunction · 0.85

Calls 1

parseHostFunction · 0.85

Tested by 4

TestDefaultEndpointFunction · 0.68
TestDockerHostEndpointFunction · 0.68
TestDockerFlagEndpointFunction · 0.68
TestUnixBadFormatFunction · 0.68