config.go 369 B

1234567891011121314151617181920
  1. package discov
  2. import "errors"
  3. // EtcdConf is the config item with the given key on etcd.
  4. type EtcdConf struct {
  5. Hosts []string
  6. Key string
  7. }
  8. // Validate validates c.
  9. func (c EtcdConf) Validate() error {
  10. if len(c.Hosts) == 0 {
  11. return errors.New("empty etcd hosts")
  12. } else if len(c.Key) == 0 {
  13. return errors.New("empty etcd key")
  14. } else {
  15. return nil
  16. }
  17. }