-
Release v1.0.2 Stable
released this
2026-05-11 22:18:25 -06:00 | 0 commits to main since this releasev1.0.2
code.nochebuena.dev/go/httpserverOverview
httpserverv1.0.2 commits the HTTP server API as stable and adds configurable
graceful-shutdown timeout. The module wraps chi's router in alauncher.Component
lifecycle with synchronous port binding, guard against nil server on stop, and a
duck-typedLoggerinterface satisfied bylogz.Logger.What Changed Since v0.9.2
Configurable
ShutdownTimeoutConfiggains aShutdownTimeout time.Durationfield (SERVER_SHUTDOWN_TIMEOUT,
default10s). Previously the graceful-shutdown deadline was hardcoded to 10 seconds.
Callers serving long-running requests (file uploads, streaming) or preferring a shorter
fail-fast window can now set this per environment without code changes.// Default: 10s — no change required for existing deployments cfg := httpserver.Config{} // Override via env or struct literal cfg.ShutdownTimeout = 30 * time.SecondDependency bumps
launcherandlogzpromoted to v1.0.1.godirective updated to 1.26.Full API (stable)
Config—Host,Port,ReadTimeout,WriteTimeout,IdleTimeout,
ShutdownTimeout; all settable viaSERVER_*environment variables.Logger— duck-typed:Info(msg string, args ...any),Error(msg string, err error, args ...any).Option— functional option type.WithMiddleware(mw ...func(http.Handler) http.Handler) Option— accumulates middleware
applied to the router duringOnInit; order preserved; multiple calls append.HttpServerComponent— embedslauncher.Componentandchi.Router; callers get the
full chi routing API (Get,Post,Route,Mount,Use,With,Group, etc.) on
the same value that participates in the launcher lifecycle.New(logger Logger, cfg Config, opts ...Option) HttpServerComponent— constructor;
no middleware installed by default.Migration from v0.9.2
No breaking changes.
ShutdownTimeoutdefaults to10s— existing deployments behave
identically without any config change.go get code.nochebuena.dev/go/httpserver@v1.0.2Downloads