Enable LiveDashboard at /dashboard with authentication
LiveDashboard is now available at /dashboard in all environments and requires user authentication to access
This commit is contained in:
parent
d80c10fa5d
commit
f050fb0eea
1 changed files with 9 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
defmodule ToweropsWeb.Router do
|
defmodule ToweropsWeb.Router do
|
||||||
use ToweropsWeb, :router
|
use ToweropsWeb, :router
|
||||||
|
|
||||||
|
import Phoenix.LiveDashboard.Router
|
||||||
import ToweropsWeb.UserAuth
|
import ToweropsWeb.UserAuth
|
||||||
|
|
||||||
pipeline :browser do
|
pipeline :browser do
|
||||||
|
|
@ -28,19 +29,18 @@ defmodule ToweropsWeb.Router do
|
||||||
# pipe_through :api
|
# pipe_through :api
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# Enable LiveDashboard and Swoosh mailbox preview in development
|
# Enable LiveDashboard in production with authentication
|
||||||
if Application.compile_env(:towerops, :dev_routes) do
|
scope "/dashboard" do
|
||||||
# If you want to use the LiveDashboard in production, you should put
|
pipe_through [:browser, :require_authenticated_user]
|
||||||
# it behind authentication and allow only admins to access it.
|
|
||||||
# If your application does not have an admins-only section yet,
|
|
||||||
# you can use Plug.BasicAuth to set up some basic authentication
|
|
||||||
# as long as you are also using SSL (which you should anyway).
|
|
||||||
import Phoenix.LiveDashboard.Router
|
|
||||||
|
|
||||||
|
live_dashboard "/", metrics: ToweropsWeb.Telemetry
|
||||||
|
end
|
||||||
|
|
||||||
|
# Enable Swoosh mailbox preview in development
|
||||||
|
if Application.compile_env(:towerops, :dev_routes) do
|
||||||
scope "/dev" do
|
scope "/dev" do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
live_dashboard "/dashboard", metrics: ToweropsWeb.Telemetry
|
|
||||||
forward "/mailbox", Plug.Swoosh.MailboxPreview
|
forward "/mailbox", Plug.Swoosh.MailboxPreview
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue