config.go 285 B

123456789101112131415161718
  1. package discov
  2. import "errors"
  3. type EtcdConf struct {
  4. Hosts []string
  5. Key string
  6. }
  7. func (c EtcdConf) Validate() error {
  8. if len(c.Hosts) == 0 {
  9. return errors.New("empty etcd hosts")
  10. } else if len(c.Key) == 0 {
  11. return errors.New("empty etcd key")
  12. } else {
  13. return nil
  14. }
  15. }