|
30 | 30 | )
|
31 | 31 | )
|
32 | 32 |
|
| 33 | +const ( |
| 34 | + defaultIdleTimeout = time.Minute * 2 |
| 35 | + defaultReadTimeout = time.Second * 15 |
| 36 | + defaultWriteTimeout = time.Second * 30 |
| 37 | +) |
| 38 | + |
33 | 39 | type EtcdConfig struct {
|
34 | 40 | Host string `long:"host" description:"host:port of an active etcd instance"`
|
35 | 41 | User string `long:"user" description:"user authorized to access the etcd host"`
|
@@ -202,6 +208,17 @@ type Config struct {
|
202 | 208 |
|
203 | 209 | // Profile is the port on which the pprof profile will be served.
|
204 | 210 | Profile uint16 `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65535"`
|
| 211 | + |
| 212 | + // IdleTimeout is the maximum amount of time a connection may be idle. |
| 213 | + IdleTimeout time.Duration `long:"idletimeout" description:"The maximum amount of time a connection may be idle before being closed."` |
| 214 | + |
| 215 | + // ReadTimeout is the maximum amount of time to wait for a request to |
| 216 | + // be fully read. |
| 217 | + ReadTimeout time.Duration `long:"readtimeout" description:"The maximum amount of time to wait for a request to be fully read."` |
| 218 | + |
| 219 | + // WriteTimeout is the maximum amount of time to wait for a response to |
| 220 | + // be fully written. |
| 221 | + WriteTimeout time.Duration `long:"writetimeout" description:"The maximum amount of time to wait for a response to be fully written."` |
205 | 222 | }
|
206 | 223 |
|
207 | 224 | func (c *Config) validate() error {
|
@@ -237,5 +254,8 @@ func NewConfig() *Config {
|
237 | 254 | Tor: &TorConfig{},
|
238 | 255 | HashMail: &HashMailConfig{},
|
239 | 256 | Prometheus: &PrometheusConfig{},
|
| 257 | + IdleTimeout: defaultIdleTimeout, |
| 258 | + ReadTimeout: defaultReadTimeout, |
| 259 | + WriteTimeout: defaultWriteTimeout, |
240 | 260 | }
|
241 | 261 | }
|
0 commit comments