123456789101112131415161718192021222324252627 |
- package kafka
- 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
- }
|