Health Checks
pkg/health exposes HTTP health check endpoints using hellofresh/health-go.
lakta.NewRuntime( config.NewModule( config.WithConfigDirs(".", "./config"), config.WithArgs(os.Args[1:]), ), slog.NewModule(), fiber.NewModule(), // health endpoints are registered on the HTTP server health.NewModule(), myapp.NewModule(),)Endpoints
Section titled “Endpoints”| Path | Description |
|---|---|
GET /health/live | Liveness — is the process alive? |
GET /health/ready | Readiness — can the service handle requests? |
Registering custom checks
Section titled “Registering custom checks”func (m *MyModule) Init(ctx context.Context) error { h := do.MustInvoke[*health.Health](lakta.GetInjector(ctx)) h.Register(health.Config{ Name: "database", Check: func(ctx context.Context) error { return m.pool.Ping(ctx) }, }) return nil}Configuration Reference
Section titled “Configuration Reference”Config path: modules.health.health.<name>
component_name componentName defines the name of the component
env
LAKTA_MODULES_HEALTH_HEALTH_<NAME>_COMPONENT_NAME component_version componentVersion represents the version of the component
env
LAKTA_MODULES_HEALTH_HEALTH_<NAME>_COMPONENT_VERSION Code-only options
Section titled “Code-only options”These options can only be set in Go code via With*() functions, not via config files or environment variables.
| Option | Type | Description |
|---|---|---|
WithCheck(...) | []health.Config | adds a health check to be registered on initialization (code-only) |