server

package
v0.0.0-...-a677d05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package server provides a generic server implementation which is used by the different applications to serve their endpoints.

Index

Constants

View Source
const (
	BuildInfoRoute   = buildinfo.MetricName
	HealthCheckRoute = "healthcheck"
	FaviconRoute     = "favicon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port      serv.Port `default:"2512"`
	AccessLog bool      `default:"true"`
	TLS       easytls.Config
}

func (Config) Validate

func (c Config) Validate() error

type Logger

type Logger interface {
	RegisterRouteLogger
	serv.Logger
	accesslog.Logger
}

type Option

type Option func(app *Server, conf Config) error

func WithBuildInfo

func WithBuildInfo(bld *buildinfo.BuildInfo) Option

func WithHealthChecker

func WithHealthChecker(hc *healthcheck.Checker) Option

func WithNotFoundHandler

func WithNotFoundHandler(h http.Handler) Option

func WithRoutesRegisterer

func WithRoutesRegisterer(r serv.RoutesRegisterer) Option

type RegisterRouteLogger

type RegisterRouteLogger interface {
	LogRegisterRoute(route serv.Route)
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(name string, conf Config, log Logger, telem *telemetry.Telemetry, opts ...Option) (*Server, error)

func (*Server) Name

func (srv *Server) Name() string

func (*Server) RouteHandler

func (srv *Server) RouteHandler() serv.RouteHandler

func (*Server) Run

func (srv *Server) Run(ctx context.Context) error

func (*Server) Shutdown

func (srv *Server) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL