mirror of https://github.com/docker/docs.git
38 lines
910 B
Go
38 lines
910 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/docker/machine/libmachine"
|
|
"github.com/docker/machine/libmachine/check"
|
|
"github.com/docker/machine/libmachine/log"
|
|
)
|
|
|
|
func cmdConfig(c CommandLine, api libmachine.API) error {
|
|
// Ensure that log messages always go to stderr when this command is
|
|
// being run (it is intended to be run in a subshell)
|
|
log.SetOutWriter(os.Stderr)
|
|
|
|
if len(c.Args()) != 1 {
|
|
return ErrExpectedOneMachine
|
|
}
|
|
|
|
host, err := api.Load(c.Args().First())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
dockerHost, authOptions, err := check.DefaultConnChecker.Check(host, c.Bool("swarm"))
|
|
if err != nil {
|
|
return fmt.Errorf("Error running connection boilerplate: %s", err)
|
|
}
|
|
|
|
log.Debug(dockerHost)
|
|
|
|
fmt.Printf("--tlsverify\n--tlscacert=%q\n--tlscert=%q\n--tlskey=%q\n-H=%s\n",
|
|
authOptions.CaCertPath, authOptions.ClientCertPath, authOptions.ClientKeyPath, dockerHost)
|
|
|
|
return nil
|
|
}
|