blob: a6261ef65ba83487d04ada834c98e8e11447b08c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package srv
import (
"log"
"net/http"
"time"
"gitlab.com/mokhax/spike/pkg/cfg"
)
func New(c *cfg.Config) *http.Server {
return &http.Server{
Addr: c.BindAddress,
Handler: c.Mux,
TLSConfig: c.TLS,
ReadHeaderTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 2 * time.Minute,
IdleTimeout: 5 * time.Minute,
ErrorLog: log.Default(),
}
}
func Run(c *cfg.Config) error {
return c.Run(New(c))
}
|