12345678910111213141516171819202122 |
- package auth
- import (
- "git.linuxforward.com/byom/byom-golang-lib/pkg/errors"
- )
- // Config holds the authentication configuration
- type Config struct {
- SecretKey string `yaml:"secret_key"`
- TokenDuration int `yaml:"token_duration"` // in seconds
- }
- // Validate implements the config.Validator interface
- func (c *Config) Validate() error {
- if c.SecretKey == "" {
- return errors.NewConfigError("auth.secret_key", errors.ErrInvalidInput)
- }
- if c.TokenDuration == 0 {
- c.TokenDuration = 86400 // 24 hours default
- }
- return nil
- }
|