package config import ( "os" "github.com/pelletier/go-toml/v2" ) type StepMonitor struct { Enabled bool `toml:"Enabled"` BaseURL string `toml:"BaseURL"` RootID string `toml:"RootID"` } type TLSConnectionMonitor struct { Enabled bool `toml:"Enabled"` Address string `toml:"Address"` Verify bool `toml:"Verify"` ExtraCAPaths []string `toml:"ExtraCAPaths"` Duration string `toml:"Duration"` } type Config struct { ListenAddr string `toml:"ListenAddr"` Profiling bool `toml:"Profiling"` Tracing bool `toml:"Tracing"` TracingEndpoint string `toml:"TracingEndpoint"` StepMonitors []StepMonitor `toml:"StepMonitors"` TLSConnectionMonitors []TLSConnectionMonitor `toml:"TLSConnectionMonitors"` } func FromFile(file string) (*Config, error) { var config Config f, err := os.Open(file) if err != nil { return nil, err } decoder := toml.NewDecoder(f) if err := decoder.Decode(&config); err != nil { return nil, err } return &config, nil }