diff --git a/config/dev.exs b/config/dev.exs index 5245e7ff..95a8b306 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -65,6 +65,9 @@ config :radiator, RadiatorWeb.Endpoint, # Enable dev routes for dashboard and mailbox config :radiator, dev_routes: true +# Enable tree consistency validator: crashes when tree is not valid! +config :radiator, tree_consistency_validator: true + # Do not include metadata nor timestamps in development logs config :logger, :console, format: "[$level] $message\n" diff --git a/config/test.exs b/config/test.exs index 70bcc7e8..c19386b0 100644 --- a/config/test.exs +++ b/config/test.exs @@ -38,3 +38,6 @@ config :phoenix, :plug_init_mode, :runtime # Enable helpful, but potentially expensive runtime checks config :phoenix_live_view, enable_expensive_runtime_checks: true + +# Enable tree consistency validator: crashes when tree is not valid! +config :radiator, tree_consistency_validator: true diff --git a/lib/radiator/outline/dispatch.ex b/lib/radiator/outline/dispatch.ex index 711ca622..ea1207f9 100644 --- a/lib/radiator/outline/dispatch.ex +++ b/lib/radiator/outline/dispatch.ex @@ -32,7 +32,8 @@ defmodule Radiator.Outline.Dispatch do end def broadcast(event) do - if Mix.env() == :dev || Mix.env() == :test do + # if enabled validate tree and crash if tree got inconsistenc + if Application.get_env(:radiator, :tree_consistency_validator, false) do :ok = event |> Event.episode_id()