I want admins to have access to error_tracker’s dashboard and i also want the dashboard to be generally available in development environment, it seems i can’t use error_tracker_dashboard("/errors")
two times as it creates a live_session
which can’t be defined more than once.
Is there a way to do that somehow?
Thanks for reading
You could wrap each one in an env check:
scope "/some-scope" do
if Mix.env() == :prod do
error_tracker_dashboard("/errors")
end
end
scope "dev-scope" do
if Mix.env() == :dev do
error_tracker_dashboard("/errors")
end
end
1 Like
Thanks but if i do this and i’m in development environment it won’t be possible to me to access admin’s errors dashboard, and it would be nice to have it so i can check if permissions system works as it should. I could write tests but i don’t to :^)
Ah, I think you’re going to have to open an issue in error_tracker then. I can’t think of any way around this otherwise
1 Like
I have re-read documentation and it seems error_tracker provides an option as
to change live_session’s name which fixes the error.
Example of working code:
if Application.compile_env(:justrunit, :dev_routes) do
import Phoenix.LiveDashboard.Router
scope "/dev" do
pipe_through :browser
live_dashboard "/dashboard", metrics: JustrunitWeb.Telemetry
forward "/mailbox", Plug.Swoosh.MailboxPreview
error_tracker_dashboard("/errors", as: :error_tracker_dashboard_dev)
end
end
scope "/", JustrunitWeb.Modules do
pipe_through [:browser, :require_authenticated_user, :error_tracker_access_check]
error_tracker_dashboard("/errors", as: :error_tracker_dashboard_admin)
end
1 Like