Provides a router macro for mounting the PhoenixFlags dashboard.
Usage
defmodule MyAppWeb.Router do
use Phoenix.Router
import PhoenixFlags.Router
scope "/admin" do
pipe_through [:browser, :require_admin]
flags_dashboard "/flags",
config: MyApp.SystemConfig
end
endOptions
:config(required) — the module thatuse PhoenixFlags:on_mount— list ofPhoenix.LiveView.on_mount/1hooks to add to the live session (e.g. for authentication):live_socket_path— defaults to"/live":app_js— path to the host application's JS bundle, which must connect a LiveSocket. Defaults to"/assets/js/app.js".:favicon— href for the dashboard's icon. Defaults to"data:,", an empty document, which stops the browser asking: a layout with no icon makes it request/favicon.ico, and a host that does not serve one gets a 404 in the console of an otherwise working page. Point it at your own to show it instead.:app_js_type— the script tag'stype. Pass"module"when the host bundle is ESM, which esbuild emits with--format=esmand which any bundle usingimport()for code splitting needs. Omitted by default, so a classic bundle is loaded as it always was.Getting this wrong is quiet and total: an ESM bundle loaded as a classic script throws
import declarations may only appear at top level of a modulebefore it defines anything, so the LiveSocket never connects and every control on the dashboard does nothing at all.
Summary
Functions
Defines routes for the PhoenixFlags dashboard.