package config import ( "beejay.kim/craft/api/database" "fmt" "time" ) type Configuration struct { Timeout int `yaml:"timeout"` Issuer string `yaml:"issuer"` Database database.Databases `yaml:"database"` } func (c Configuration) Invalidate() error { if c.Timeout < 1 { c.Timeout = 30 } if c.Issuer == "" { return fmt.Errorf("`issuer` must not be an empty string") } return Invalidate(c) } func (c Configuration) TimeoutDuration() time.Duration { return time.Duration(c.Timeout) * time.Second }