123456789101112131415161718192021222324252627282930 |
- package config
- import (
- "fmt"
- _interface "git.beejay.kim/Craft/Api/database/interface"
- "time"
- )
- type Configuration struct {
- Timeout int `yaml:"timeout"`
- Issuer string `yaml:"issuer"`
- Database _interface.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
- }
|