1 Star 0 Fork 0

litian / machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.go 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
package commands
import (
"fmt"
"os"
"path/filepath"
"github.com/docker/machine/commands/mcndirs"
"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)
target, err := targetHost(c, api)
if err != nil {
return err
}
host, err := api.Load(target)
if err != nil {
return err
}
dockerHost, _, err := check.DefaultConnChecker.Check(host, c.Bool("swarm"))
if err != nil {
return fmt.Errorf("Error running connection boilerplate: %s", err)
}
log.Debug(dockerHost)
tlsCACert := filepath.Join(mcndirs.GetMachineDir(), host.Name, "ca.pem")
tlsCert := filepath.Join(mcndirs.GetMachineDir(), host.Name, "cert.pem")
tlsKey := filepath.Join(mcndirs.GetMachineDir(), host.Name, "key.pem")
// TODO(nathanleclaire): These magic strings for the certificate file
// names should be cross-package constants.
fmt.Printf("--tlsverify\n--tlscacert=%q\n--tlscert=%q\n--tlskey=%q\n-H=%s\n",
tlsCACert, tlsCert, tlsKey, dockerHost)
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/litian33/machine.git
git@gitee.com:litian33/machine.git
litian33
machine
machine
v0.12.0-rc1

搜索帮助

344bd9b3 5694891 D2dac590 5694891