package config import "errors" type MasterConfig struct { ObserverInterval int `toml:"observer_interval"` BackoffSeconds int `toml:"backoff_seconds"` BackoffCount int `toml:"backoff_count"` baseRoleConfig } func (c MasterConfig) Validate() error { if c.ObserverInterval < 1 { return errors.New("invalid observer_interval") } if c.BackoffSeconds < 1 { return errors.New("invalid backoff_seconds") } if c.BackoffCount < 1 { return errors.New("invalid backoff_count") } return nil } func (c *MasterConfig) Merge(other MasterConfig) { if other.set { c.set = true } if other.ObserverInterval != 0 { c.ObserverInterval = other.ObserverInterval } if other.BackoffSeconds != 0 { c.BackoffSeconds = other.BackoffSeconds } if other.BackoffCount != 0 { c.BackoffCount = other.BackoffCount } }