|
- package control
-
- import (
- "net/http"
- "time"
-
- "github.com/jan/fm-rds-tx/internal/config"
- )
-
- const (
- defaultReadTimeout = 5 * time.Second
- defaultWriteTimeout = 10 * time.Second
- defaultIdleTimeout = 60 * time.Second
- defaultMaxHeaderBytes = 1 << 20 // 1 MiB
- )
-
- // NewHTTPServer returns a configured HTTP server for the control plane.
- func NewHTTPServer(cfg config.Config, handler http.Handler) *http.Server {
- return &http.Server{
- Addr: cfg.Control.ListenAddress,
- Handler: handler,
- ReadTimeout: defaultReadTimeout,
- WriteTimeout: defaultWriteTimeout,
- IdleTimeout: defaultIdleTimeout,
- MaxHeaderBytes: defaultMaxHeaderBytes,
- }
- }
|