Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMiddlewareType ¶
type AuthMiddlewareType = string
const ( UserAuth AuthMiddlewareType = "USER" AdminAuth AuthMiddlewareType = "ADMIN" )
type Option ¶
type Option func(*Server)
Option customizes the Server that New creates.
func WithGlobalTelemetry ¶
func WithGlobalTelemetry() Option
WithGlobalTelemetry makes the server install its OpenTelemetry tracer provider, error handler and propagator as the process-wide ones when it starts. Only the startup wiring (main) asks for it: the OpenTelemetry API has no other way to give a provider to the instrumented libraries.
func WithListener ¶
WithListener makes the HTTP server serve on an already bound listener instead of binding the configured address. A caller that needs a free port keeps it bound until the server uses it, instead of closing it and hoping that nothing else takes the port before the server binds it. The server owns the listener: it closes it when it stops, or when it is stopped before it started.
func WithMonitoringListener ¶
WithMonitoringListener is WithListener for the monitoring server: it serves on the given bound listener instead of binding the configured monitoring port. The monitoring port must still be configured (it decides whether a monitoring server exists). The server owns the listener.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the struct that represents the API server.
func New ¶
func New(config *config.Config, services service.Services, zapLog *zap.Logger, opts ...Option, ) Server
New is used to create a new instance of the API server.