24h
()
| 262 | const maxHTTPTimeoutMS = 86400000 // 24h |
| 263 | |
| 264 | func (c *Config) validateServerHTTPTimeouts() error { |
| 265 | check := func(field string, ms int) error { |
| 266 | if ms < 0 { |
| 267 | return fmt.Errorf("config validation: %s cannot be negative", field) |
| 268 | } |
| 269 | if ms > maxHTTPTimeoutMS { |
| 270 | return fmt.Errorf("config validation: %s exceeds 24h", field) |
| 271 | } |
| 272 | return nil |
| 273 | } |
| 274 | if err := check("server.http.read_timeout_ms", c.Server.HTTP.ReadTimeoutMS); err != nil { |
| 275 | return err |
| 276 | } |
| 277 | if err := check("server.http.write_timeout_ms", c.Server.HTTP.WriteTimeoutMS); err != nil { |
| 278 | return err |
| 279 | } |
| 280 | return check("server.http.idle_timeout_ms", c.Server.HTTP.IdleTimeoutMS) |
| 281 | } |
| 282 | |
| 283 | func (c *Config) validate() error { |
| 284 | if err := c.validateServerHTTPTimeouts(); err != nil { |