Bandera.Dashboard.Router (bandera v0.2.0)

Copy Markdown View Source

Router macro for mounting the Bandera dashboard.

import Bandera.Dashboard.Router

scope "/admin" do
  pipe_through [:browser, :require_admin]   # YOUR auth pipeline
  bandera_dashboard "/flags"
end

Auth is the host's responsibility: always mount behind an authenticated, admin-only pipeline. The dashboard can toggle production features.

The dashboard ships no JavaScript and sets no root layout: it inherits the layout from the pipeline/endpoint and runs on the host's existing LiveView socket. Mount it under a pipeline whose layout loads your app.js (the default :browser pipeline does).

Options:

  • :live_session_name — name for the generated live_session (default :bandera_dashboard). Override when mounting more than once.
  • :on_mount — an on_mount hook (or list) passed to the live_session, for plugging authz into the dashboard's own mount lifecycle.

Summary

Functions

Mounts the Bandera dashboard LiveView at path.

Functions

bandera_dashboard(path, opts \\ [])

(macro)

Mounts the Bandera dashboard LiveView at path.