Malachi.Dashboard (malachi v0.22.7)

View Source

The built-in HTTP dashboard: a GenServer that listens on a port and serves the operational UI and metrics endpoints over plain HTTP.

It accepts connections on its listen socket and handles each request in a spawned process, wrapping the routed handlers with authentication (Malachi.Auth), per-IP rate limiting (Malachi.RateLimiter), security headers (Malachi.Dashboard.SecurityHeaders), and audit logging (Malachi.AuditLog).

Summary

Functions

Returns a specification to start this module under a supervisor.

The port the dashboard registered as name bound, which differs from the configured one when that was

Starts the dashboard HTTP server listening on port, registered under the module name. {port, name: name} registers it under name instead, which is how a test runs one beside the application's. Port 0 asks the operating system for a free port; port/1 answers which.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

port(name \\ __MODULE__)

@spec port(atom()) :: :inet.port_number() | nil

The port the dashboard registered as name bound, which differs from the configured one when that was

  1. After the dashboard stops this is still the last port it bound; nil if it never started. Read from :persistent_term rather than asked of the server, which spends its life blocked in accept.

start_link(port)

Starts the dashboard HTTP server listening on port, registered under the module name. {port, name: name} registers it under name instead, which is how a test runs one beside the application's. Port 0 asks the operating system for a free port; port/1 answers which.