Cairnloop.Router (cairnloop v0.5.0)

Copy Markdown View Source

Host-router macros for mounting Cairnloop's operator surfaces.

Cairnloop is host-owned: you mount its operations endpoints and operator dashboard into your router, under your pipelines, so auth, session, layout, and route placement stay yours. See cairnloop_operations/1 and cairnloop_dashboard/2.

Summary

Functions

Mounts the Cairnloop operator dashboard (inbox, conversations, knowledge base, settings, and the audit-log timeline) under path as a single Phoenix.LiveView live_session.

Mounts the operations endpoints a host needs for monitoring (OPS-01, OPS-02)

Functions

cairnloop_dashboard(path, opts \\ [])

(macro)

Mounts the Cairnloop operator dashboard (inbox, conversations, knowledge base, settings, and the audit-log timeline) under path as a single Phoenix.LiveView live_session.

Wrap it in your own scope so auth/session/layout stay host-owned — Cairnloop does not embed auth:

scope "/support" do
  pipe_through [:browser, :require_admin]

  cairnloop_dashboard "/",
    session: %{"host_user_id" => "demo_operator"},
    on_mount: [{MyAppWeb.UserAuth, :ensure_admin}]
end

Any option other than the Cairnloop-specific ones below is forwarded verbatim to Phoenix.LiveView.Router.live_session/3 (e.g. :session, :on_mount, :root_layout, :layout).

Options

  • :live_session_name (atom/0) - Name of the generated live_session. Override when mounting the dashboard more than once in a single host router, so the two live_session names do not collide. The default value is :cairnloop_dashboard.

cairnloop_operations(opts \\ [])

(macro)

Mounts the operations endpoints a host needs for monitoring (OPS-01, OPS-02):

Call it from your host router, typically outside any authentication pipeline so infrastructure can reach the probes:

scope "/" do
  cairnloop_operations()
end

Options

  • :health_path (String.t/0) - Path the /health liveness probe is mounted at. The default value is "/health".

  • :metrics_path (String.t/0) - Path the /metrics Prometheus scrape endpoint is mounted at. The default value is "/metrics".