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
|
||||
use ToweropsWeb, :router
|
||||
|
||||
import Phoenix.LiveDashboard.Router
|
||||
import ToweropsWeb.UserAuth
|
||||
|
||||
pipeline :browser do
|
||||
|
|
@ -28,19 +29,18 @@ defmodule ToweropsWeb.Router do
|
|||
# pipe_through :api
|
||||
# end
|
||||
|
||||
# Enable LiveDashboard and Swoosh mailbox preview in development
|
||||
if Application.compile_env(:towerops, :dev_routes) do
|
||||
# If you want to use the LiveDashboard in production, you should put
|
||||
# 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
|
||||
# Enable LiveDashboard in production with authentication
|
||||
scope "/dashboard" do
|
||||
pipe_through [:browser, :require_authenticated_user]
|
||||
|
||||
live_dashboard "/", metrics: ToweropsWeb.Telemetry
|
||||
end
|
||||
|
||||
# Enable Swoosh mailbox preview in development
|
||||
if Application.compile_env(:towerops, :dev_routes) do
|
||||
scope "/dev" do
|
||||
pipe_through :browser
|
||||
|
||||
live_dashboard "/dashboard", metrics: ToweropsWeb.Telemetry
|
||||
forward "/mailbox", Plug.Swoosh.MailboxPreview
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue