12345678910111213141516171819202122232425 |
- package consumer
- import "fmt"
- type Config struct {
- Hosts []string `yaml:"hosts"`
- Group string `yaml:"group"`
- Timeout int `yaml:"timeout"`
- }
- func (c Config) Invalidate() error {
- if len(c.Hosts) < 1 {
- return fmt.Errorf("at least one bootstrap server / host must be provided")
- }
- if c.Group == "" {
- return fmt.Errorf("group name must not be an empty string")
- }
- if c.Timeout < 1 {
- c.Timeout = 100
- }
- return nil
- }
|