package server import "time" // Config holds the server configuration type Config struct { Port int `yaml:"port"` RequestTimeout time.Duration `yaml:"request_timeout"` // in seconds AllowedOrigins []string `yaml:"allowed_origins"` } // Validate implements the config.Validator interface func (c *Config) Validate() error { if c.Port == 0 { c.Port = 8080 } if c.RequestTimeout == 0 { c.RequestTimeout = 30 * time.Second } return nil } // ToServerConfig converts Config to ServerConfig for internal use func (c *Config) ToServerConfig() ServerConfig { return ServerConfig{ AllowedOrigins: c.AllowedOrigins, RequestTimeout: c.RequestTimeout, } }