gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/helpers/docker/credentials.go (about)

     1  package docker_helpers
     2  
     3  import (
     4  	"os"
     5  	"strconv"
     6  )
     7  
     8  type DockerCredentials struct {
     9  	Host      string `toml:"host,omitempty" json:"host" long:"host" env:"DOCKER_HOST" description:"Docker daemon address"`
    10  	CertPath  string `toml:"tls_cert_path,omitempty" json:"tls_cert_path" long:"cert-path" env:"DOCKER_CERT_PATH" description:"Certificate path"`
    11  	TLSVerify bool   `toml:"tls_verify,omitzero" json:"tls_verify" long:"tlsverify" env:"DOCKER_TLS_VERIFY" description:"Use TLS and verify the remote"`
    12  }
    13  
    14  func credentialsFromEnv() DockerCredentials {
    15  	tlsVerify, _ := strconv.ParseBool(os.Getenv("DOCKER_TLS_VERIFY"))
    16  	return DockerCredentials{
    17  		Host:      os.Getenv("DOCKER_HOST"),
    18  		CertPath:  os.Getenv("DOCKER_CERT_PATH"),
    19  		TLSVerify: tlsVerify,
    20  	}
    21  }