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