示例#1
0
文件: utils.go 项目: zanella/nomad
func consulContext(clientConfig *config.Config, containerID string) *executor.ConsulContext {
	return &executor.ConsulContext{
		ConsulConfig:   clientConfig.ConsulConfig,
		ContainerID:    containerID,
		DockerEndpoint: clientConfig.Read("docker.endpoint"),
		TLSCa:          clientConfig.Read("docker.tls.ca"),
		TLSCert:        clientConfig.Read("docker.tls.cert"),
		TLSKey:         clientConfig.Read("docker.tls.key"),
	}
}
示例#2
0
func consulContext(clientConfig *config.Config, containerID string) *executor.ConsulContext {
	cfg := consul.ConsulConfig{
		Addr:      clientConfig.ReadDefault("consul.address", "127.0.0.1:8500"),
		Token:     clientConfig.Read("consul.token"),
		Auth:      clientConfig.Read("consul.auth"),
		EnableSSL: clientConfig.ReadBoolDefault("consul.ssl", false),
		VerifySSL: clientConfig.ReadBoolDefault("consul.verifyssl", true),
		CAFile:    clientConfig.Read("consul.tls_ca_file"),
		CertFile:  clientConfig.Read("consul.tls_cert_file"),
		KeyFile:   clientConfig.Read("consul.tls_key_file"),
	}
	return &executor.ConsulContext{
		ConsulConfig:   &cfg,
		ContainerID:    containerID,
		DockerEndpoint: clientConfig.Read("docker.endpoint"),
		TLSCa:          clientConfig.Read("docker.tls.ca"),
		TLSCert:        clientConfig.Read("docker.tls.cert"),
		TLSKey:         clientConfig.Read("docker.tls.key"),
	}
}