httpapi

package
v0.0.0-...-41b648b Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package httpapi contains the chi router, HTTP handlers, and middleware.

Handlers are deliberately THIN: they translate HTTP <-> service calls and own no business logic (which lives in internal/service, transport-agnostic so a gRPC transport can be added later). M0 wires only health/readiness; the /api/v1 surface is filled in over subsequent milestones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(d Deps) http.Handler

New builds the API router.

Types

type Deps

type Deps struct {
	Logger    *slog.Logger
	Version   string
	Readiness ReadinessProbe
	// Services is the business-logic facade. When nil (e.g. before provisioning),
	// only the health endpoints are served.
	Services *service.Services
	// MetricsToken, when set, guards the /metrics endpoint with a bearer token.
	MetricsToken string
	// AuthMiddleware guards the product endpoints (set in M8). When nil, endpoints
	// are unauthenticated.
	AuthMiddleware func(http.Handler) http.Handler
	// SCIMHandler, when non-nil (paid editions with SCIM licensed), serves the SCIM
	// 2.0 protocol at /scim/v2 with its own per-org bearer-token auth. Nil in OSS.
	SCIMHandler http.Handler
}

Deps are the dependencies the router needs.

type ReadinessProbe

type ReadinessProbe interface {
	Check(ctx context.Context) (ready bool, components map[string]string)
}

ReadinessProbe reports the health of buktio's dependencies. The map is component -> status ("ok" | "down" | ...). It is implemented in main (M0) and by the storage/db layers in later milestones.

Jump to

Keyboard shortcuts

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