Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultReadHeaderTimeout = 5 * time.Second DefaultReadTimeout = 10 * time.Second DefaultWriteTimeout = 10 * time.Second DefaultIdleTimeout = 60 * time.Second DefaultMaxHeaderBytes = 1 << 20 // 1 MB )
Server timeout defaults, shared with opshttp.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler builds an HTTP handler with routes + middleware main() owns *http.Server so it can do graceful shutdown
Types ¶
type Options ¶
type Options struct {
Logger log.Logger
Port int
UseRecoverMW bool
OnPanic func() // Optional callback for when panics are recovered, e.g. to trigger alerts or increment prometheus counters, etc.
APIRoutes func(chi.Router) // Provenance API routes
SiteHandler http.Handler // Main site handler
MetricsMW func(http.Handler) http.Handler
RateLimitMW func(http.Handler) http.Handler
Health health.Probe
Readiness health.Probe
ContentInfo httpmw.ContentInfo // For X-Content-Bundle-Version and X-Content-Hash headers
ClientIPOpts httpmw.ClientIPOptions // Client IP extraction options (TrustedHops, etc.)
}
Click to show internal directories.
Click to hide internal directories.