|
|
@ -13,6 +13,7 @@ var (
|
|
|
|
type EtcdConf struct {
|
|
|
|
type EtcdConf struct {
|
|
|
|
Hosts []string
|
|
|
|
Hosts []string
|
|
|
|
Key string
|
|
|
|
Key string
|
|
|
|
|
|
|
|
ServerID int64 `json:",optional"`
|
|
|
|
User string `json:",optional"`
|
|
|
|
User string `json:",optional"`
|
|
|
|
Pass string `json:",optional"`
|
|
|
|
Pass string `json:",optional"`
|
|
|
|
CertFile string `json:",optional"`
|
|
|
|
CertFile string `json:",optional"`
|
|
|
@ -26,6 +27,11 @@ func (c EtcdConf) HasAccount() bool {
|
|
|
|
return len(c.User) > 0 && len(c.Pass) > 0
|
|
|
|
return len(c.User) > 0 && len(c.Pass) > 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// HasServerID returns if ServerID provided.
|
|
|
|
|
|
|
|
func (c EtcdConf) HasServerID() bool {
|
|
|
|
|
|
|
|
return c.ServerID > 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// HasTLS returns if TLS CertFile/CertKeyFile/CACertFile are provided.
|
|
|
|
// HasTLS returns if TLS CertFile/CertKeyFile/CACertFile are provided.
|
|
|
|
func (c EtcdConf) HasTLS() bool {
|
|
|
|
func (c EtcdConf) HasTLS() bool {
|
|
|
|
return len(c.CertFile) > 0 && len(c.CertKeyFile) > 0 && len(c.CACertFile) > 0
|
|
|
|
return len(c.CertFile) > 0 && len(c.CertKeyFile) > 0 && len(c.CACertFile) > 0
|
|
|
|