Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface {
common.Service
// health.go: a listener that stopped serving fails both probes - a
// restart rebuilds the echo instances and re-binds it, so it is
// liveness-fixable, and it is equally not ready for traffic.
common.Liveness
common.Readiness
common.Initializable
common.Daemon
Get(name string) (Server, error)
List() []Server
RegisterRouters(routers ...api.Router) error
RegisterMiddlewares(middlewares ...api.Middleware) error
Add(name string, opts ...ServerOption) error
}
Manager manages multiple server instances.
type ServerOption ¶
type ServerOption func(*server)
ServerOption configures a server (echo server instance)
func WithEndpoint ¶
func WithEndpoint(host string, port uint, prefix string) ServerOption
func WithMiddlewareConfigs ¶ added in v0.6.1
func WithMiddlewareConfigs(defaults []byte) ServerOption
WithMiddlewareConfigs sets the server's default middleware configs, a plain mapping of middleware name to config - unlike a router.yaml middleware list, which stays a sequence because attachment order matters there:
cors: true throttle: rps: 100.0 burst_size: 200
The server's built-in cors middleware reads its block from the same mapping under "cors", so that name is the server's own; the lifecycle built-ins (recover, logger, info, error) take no config and claim no names.
Each block is what a middleware's Func receives when nothing more specific exists. Config resolves most-specific-first: a handler entry's own block, else its group entry's, else this server config, else nil - and server-level middlewares (WithMiddlewares) are built with theirs in place of nil. Invalid YAML fails Add.
func WithMiddlewares ¶ added in v0.6.0
func WithMiddlewares(mws ...api.Middleware) ServerOption
WithMiddlewares installs middlewares on the server itself, running on every request - matched or not - inside the built-in recover and cors but ahead of the rest of the lifecycle. Each is built with the server's middleware config under its name and survives the echo rebuild a restart performs. RequestInfo does not exist yet at this position; a middleware that reads it belongs in router.yaml instead.
func WithTLS ¶
func WithTLS(cert certutil.CertBundle, auth bool) ServerOption