Skip to content

Commit

Permalink
Merge cde1a9a into 0a82db1
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinchengx committed Feb 21, 2017
2 parents 0a82db1 + cde1a9a commit 2d279e6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion dockertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ func (r *Resource) GetPort(id string) string {
return m[0].HostPort
}

// NewTLSPool creates a new pool given an endpoint and the certificate path. This is required for endpoints that
// require TLS communication.
func NewTLSPool(endpoint, certpath string) (*Pool, error) {
ca := fmt.Sprintf("%s/ca.pem", certpath)
cert := fmt.Sprintf("%s/cert.pem", certpath)
key := fmt.Sprintf("%s/key.pem", certpath)

client, err := dc.NewTLSClient(endpoint, cert, key, ca)
if err != nil {
return nil, errors.Wrap(err, "")
}

return &Pool{
Client: client,
}, nil
}

// NewPool creates a new pool. You can pass an empty string to use the default, which is taken from the environment
// variable DOCKER_URL or if that is not defined a sensible default for the operating system you are on.
func NewPool(endpoint string) (*Pool, error) {
Expand All @@ -51,7 +68,7 @@ func NewPool(endpoint string) (*Pool, error) {
endpoint = "unix:///var/run/docker.sock"
}
}

client, err := dc.NewClient(endpoint)
if err != nil {
return nil, errors.Wrap(err, "")
Expand Down

0 comments on commit 2d279e6

Please sign in to comment.