blob: e7189406578fea4885fcc2330cc2b5a8182a5f79 (
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: 30 * time.Second,
IdleTimeout: 30 * time.Second,
ErrorLog: log.Default(),
}
}
func Run(c *cfg.Config) error {
return c.Run(New(c))
}
|