Documentation
¶
Index ¶
Constants ¶
View Source
const EndpointFieldName = "server.http.routes.health_check"
EndpointFieldName имя поля в конфигурации
Variables ¶
View Source
var Component = &compogo.Component{ Dependencies: compogo.Components{ &chi.Component, }, Init: compogo.StepFunc(func(container compogo.Container) error { return container.Provide(NewConfig) }), BindFlags: compogo.BindFlags(func(flagSet flag.FlagSet, container compogo.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Endpoint, EndpointFieldName, EndpointDefault, "path for liveness test endpoint") }) }), Configuration: compogo.StepFunc(func(container compogo.Container) (err error) { return container.Invoke(Configuration) }), PreExecute: compogo.StepFunc(func(container compogo.Container) error { return container.Invoke(func(config *Config, r httpServer.Router, logger compogo.Logger) { logger.GetLogger("http"). GetLogger("server"). GetLogger("router"). GetLogger("chi"). Infof("add health endpoint - '%s'", config.Endpoint) r.Use(httpServer.MiddlewareFunc(middleware.Heartbeat(config.Endpoint))) }) }), }
Component — компонент health-check эндпоинта для chi-роутера. Добавляет эндпоинт для проверки живости сервиса (liveness probe).
View Source
var EndpointDefault = "/health-check"
EndpointDefault путь по умолчанию
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Endpoint string
}
Config содержит конфигурацию health-check эндпоинта.
func Configuration ¶
func Configuration(config *Config, configurator compogo.Configurator) *Config
Configuration загружает конфигурацию из Configurator.
Click to show internal directories.
Click to hide internal directories.