本文整理匯總了Golang中github.com/hashicorp/nomad/client/config.Config.Read方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.Read方法的具體用法?Golang Config.Read怎麽用?Golang Config.Read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hashicorp/nomad/client/config.Config
的用法示例。
在下文中一共展示了Config.Read方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: consulContext
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: consulContext
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"),
}
}