Skip to main content

Module http

Module http 

Source
Expand description

Embedded HTTP server.

environmentd embeds an HTTP server for introspection into the running process. At the moment, its primary exports are Prometheus metrics, heap profiles, and catalog dumps.

§Authentication flow

The server supports several authentication modes, controlled by the configured listeners::AuthenticatorKind. The general flow is:

  1. Identity resolution. An authentication middleware runs on every protected request and resolves the caller’s identity via one of:

  2. Session initialization. Once the caller’s identity is known, an adapter session is opened on their behalf. This happens as part of request processing, after all middleware has run.

  3. Request handling. The handler executes the request (e.g. runs SQL) using the initialized adapter session.

§WebSocket

The WebSocket flow is identical to the HTTP flow with two differences:

  • Credentials are not read from request headers. Instead, the first message sent by the client is treated as the authentication message.
  • Session initialization (step 2) happens inside the WebSocket handler itself, rather than as a separate middleware step.

Modules§

catalog 🔒
Catalog introspection HTTP endpoints.
cluster 🔒
HTTP proxy for cluster replica endpoints.
console 🔒
HTTP endpoints for the web console.
mcp 🔒
Model Context Protocol (MCP) HTTP handlers.
memory 🔒
metrics 🔒
Metrics tracked for environmentds HTTP servers.
metrics_viz 🔒
probe 🔒
Health check HTTP endpoints.
prometheus 🔒
root 🔒
HTTP endpoints for the homepage and static files.
sql 🔒
webhook 🔒
Helpers for handling events from a Webhook source.

Structs§

AuthedClient
AuthedUser
HttpConfig
HttpServer
InternalRouteConfig
LoginCredentials
Metrics
SqlResponse
The response to a SqlRequest.
TowerSessionData
WebhookState
WsState

Enums§

AuthError 🔒
ConnProtocol 🔒
Credentials 🔒
WebSocketAuth
WebSocketResponse

Constants§

MAX_REQUEST_SIZE
Maximum allowed size for a request.
PROFILING_API_ENDPOINTS 🔒
SESSION_DURATION 🔒

Traits§

DefaultLayers 🔒
Default layers that should be applied to all routes, and should get applied to both the internal http and external http routers.

Functions§

auth 🔒
check_role_allowed 🔒
ensure_session_unexpired 🔒
Ensures the session is still valid by checking for expiration, and returns the associated user if the session remains active.
get_authenticator 🔒
handle_leader_promote
handle_leader_skip_catchup
handle_leader_status
handle_load_error 🔒
Glue code to make tower work with axum.
handle_login
handle_logout
http_auth 🔒
init_ws 🔒
maybe_get_authenticated_session 🔒
Attempts to retrieve session data from a TowerSession, if available. Session data is present only if an authenticated session has been established via handle_login.
x_materialize_user_header_auth 🔒

Type Aliases§

Delayed 🔒