2019-02-19 23:56:41 +00:00
|
|
|
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Drone Non-Commercial License
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
2019-03-13 21:47:47 +00:00
|
|
|
// +build !oss
|
|
|
|
|
2019-02-19 23:56:41 +00:00
|
|
|
package machine
|
|
|
|
|
|
|
|
// import (
|
|
|
|
// "io/ioutil"
|
|
|
|
// "net/http"
|
|
|
|
// "path/filepath"
|
|
|
|
|
|
|
|
// "docker.io/go-docker"
|
|
|
|
// "docker.io/go-docker/api"
|
|
|
|
// "github.com/docker/go-connections/tlsconfig"
|
|
|
|
// )
|
|
|
|
|
|
|
|
// // Client returns a new Docker client from the
|
|
|
|
// // machine directory.
|
|
|
|
// func Client(path string) (docker.APIClient, error) {
|
|
|
|
// // read the docker-machine configuration file from
|
|
|
|
// // the local machine directory.
|
|
|
|
// configPath, err := := filepath.Join(path, "config.json")
|
|
|
|
// if err != nil {
|
|
|
|
// return nil, err
|
|
|
|
// }
|
|
|
|
// config :=
|
|
|
|
|
|
|
|
// options := tlsconfig.Options{
|
|
|
|
// CAFile: filepath.Join(path, "ca.pem"),
|
|
|
|
// CertFile: filepath.Join(path, "cert.pem"),
|
|
|
|
// KeyFile: filepath.Join(path, "key.pem"),
|
|
|
|
// InsecureSkipVerify: false,
|
|
|
|
// }
|
|
|
|
// tlsc, err := tlsconfig.Client(options)
|
|
|
|
// if err != nil {
|
|
|
|
// return nil, err
|
|
|
|
// }
|
|
|
|
// client = &http.Client{
|
|
|
|
// Transport: &http.Transport{
|
|
|
|
// TLSClientConfig: tlsc,
|
|
|
|
// },
|
|
|
|
// CheckRedirect: docker.CheckRedirect,
|
|
|
|
// }
|
|
|
|
// return docker.NewClient(host, api.DefaultVersion, client, nil)
|
|
|
|
// }
|