Documentation
¶
Overview ¶
DI registration for shared servers and the application orchestrator.
gRPC server construction and interceptors.
Package server constructs and configures the shared HTTP and gRPC servers.
Application orchestrates starting and gracefully shutting down HTTP, gRPC, database (gorm), Valkey, and telemetry providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGRPC ¶
NewGRPC builds and returns a *grpc.Server with OTel StatsHandler, panic recovery + logging interceptors (unary and stream), and conservative message-size limits.
func NewHTTP ¶
NewHTTP builds and returns an *echo.Echo with the standard middleware stack and shared routes (/healthz, /readyz, /metrics).
func Register ¶
Register wires *echo.Echo, *grpc.Server, and the Application orchestrator into the DI container. It depends on config, logger, telemetry providers, and the health registry already being registered.
Note: samber/do v2's Provide signature is `func Provide[T any](i Injector, provider Provider[T])` and returns no error. Any construction failure surfaces later via do.Invoke. We rely on the provider functions to surface their own errors via Invoke.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application holds the runtime components required to start and stop the service. It is constructed from a populated DI container and keeps the orchestration logic separate from the wiring code.
func NewApplication ¶
NewApplication builds the runtime orchestrator from a populated DI container. It reads optional shutdown callbacks from the container and will look up infrastructure dependencies at runtime inside Run.
func (*Application) Echo ¶
func (a *Application) Echo() *echo.Echo
Echo returns the underlying HTTP server. Tests and callers outside the package may use it to mount routes or drive httptest servers. The server is resolved lazily on the first call so that routes are available before Run().
func (*Application) HTTPAddr ¶
func (a *Application) HTTPAddr() string
HTTPAddr returns the bound listener address after Run() has started the HTTP server. It returns an empty string before the server has started.
func (*Application) HasHTTPStarted ¶
func (a *Application) HasHTTPStarted() <-chan struct{}
HasHTTPStarted returns a channel that is closed once the HTTP listener has been bound. Callers can use it to wait for the server to be ready.
func (*Application) Logger ¶
func (a *Application) Logger() *zerolog.Logger
Logger returns the application logger.