package config import "io" type Config struct { Services []*Service `json:"services,omitempty" yaml:"services,omitempty"` } type Service struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Addr string `json:"addr,omitempty" yaml:"addr,omitempty"` Checks []Check `json:"checks,omitempty" yaml:"checks,omitempty"` } type Check struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Data string `json:"data,omitempty" yaml:"data,omitempty"` Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"` } func (cfg *Config) Parse(r io.Reader) error { buf, err := io.ReadAll(r) if err != nil { return err } return yaml.Unmarshal(buf, cfg) }