Documentation
¶
Index ¶
- Constants
- func NewFilesDeleteHandler(g git.Git) libhttp.WithError
- func NewFilesDispatchHandler(getH, listH http.Handler) http.Handler
- func NewFilesGetHandler(g git.Git) libhttp.WithError
- func NewFilesListHandler(g git.Git) libhttp.WithError
- func NewFilesPostHandler(g git.Git) libhttp.WithError
- func NewGatewaySecretMiddleware(secret string) func(http.Handler) http.Handler
- func NewMetricsMiddleware(m metrics.Metrics, next http.Handler) http.Handler
- func NewReadinessHandler(g git.Git) libhttp.WithError
Constants ¶
const HeaderGatewayInitator = "X-Gateway-Initator"
HeaderGatewayInitator is the request-header name the auth middleware expects to carry caller identity. The misspelling (missing the second 'i' in "Initator") is deliberate — it matches the existing caller-side convention and is part of the frozen public contract. Do not "fix" it.
const HeaderGatewaySecret = "X-Gateway-Secret"
HeaderGatewaySecret is the request-header name the auth middleware expects to carry the shared secret value.
Variables ¶
This section is empty.
Functions ¶
func NewFilesDeleteHandler ¶
NewFilesDeleteHandler returns a WithError handler that deletes a file from the git repository.
func NewFilesDispatchHandler ¶ added in v0.6.2
NewFilesDispatchHandler routes GET /api/v1/files/ to listH when the glob query parameter is present, and to getH otherwise.
func NewFilesGetHandler ¶
NewFilesGetHandler returns a WithError handler that reads a file from the git repository.
func NewFilesListHandler ¶
NewFilesListHandler returns a WithError handler that lists files in the git repository matching a glob pattern.
func NewFilesPostHandler ¶
NewFilesPostHandler returns a WithError handler that writes a file to the git repository.
func NewGatewaySecretMiddleware ¶ added in v0.17.0
NewGatewaySecretMiddleware returns a gorilla mux-compatible middleware (func(http.Handler) http.Handler) that enforces shared-secret header auth.
Check order (first failure wins):
- X-Gateway-Initator missing or empty → 500 (initiator identity required)
- X-Gateway-Secret missing, empty, or not equal to secret → 401
- Both present and matching → strip X-Gateway-Secret, call next
"Missing" and "empty string" are treated identically for both headers: r.Header.Get returning "" triggers the same response regardless of whether the client omitted the header or sent an empty value.
X-Gateway-Secret is deleted from the request before the inner handler is called so it cannot appear in downstream request logs or metrics labels.
func NewMetricsMiddleware ¶ added in v0.6.2
NewMetricsMiddleware wraps next with Prometheus HTTP request counting.
Types ¶
This section is empty.