LiveDashboard v0.2.4 Phoenix.LiveDashboard.Router View Source

Provides LiveView routing for LiveDashboard.

Link to this section Summary

Functions

Defines a LiveDashboard route.

Link to this section Functions

Link to this macro

live_dashboard(path, opts \\ [])

View Source (macro)

Defines a LiveDashboard route.

It expects the path the dashboard will be mounted at and a set of options.

Options

  • :metrics - Configures the module to retrieve metrics from. It can be a module or a {module, function}. If nothing is given, the metrics functionality will be disabled.

  • :env_keys - Configures environment variables to display. It is defined as a list of string keys. If not set, the environment information will not be displayed.

  • :live_socket_path - Configures the socket path. it must match the socket "/live", Phoenix.LiveView.Socket in your endpoint.

Examples

defmodule MyAppWeb.Router do
  use Phoenix.Router
  import Phoenix.LiveDashboard.Router

  scope "/", MyAppWeb do
    pipe_through [:browser]
    live_dashboard "/dashboard",
      metrics: {MyAppWeb.Telemetry, :metrics},
      env_keys: ["APP_USER", "VERSION"]
  end
end