Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Do not send slack message on self hosted

Uku Taht83b646eaea48
diff --git a/lib/plausible/slack.ex b/lib/plausible/slack.ex
index 3270840dfc..0789dfcf2b 100644
--- a/lib/plausible/slack.ex
+++ b/lib/plausible/slack.ex
@@ -3,12 +3,10 @@ defmodule Plausible.Slack do
def notify(text) do
Task.start(fn ->
- case Application.get_env(:plausible, :environment) do
- "prod" ->
- HTTPoison.post!(webhook_url(), Poison.encode!(%{text: text}))
-
- _ ->
- Logger.debug(text)
+ if env() == "prod" && !self_hosted() do
+ HTTPoison.post!(webhook_url(), Poison.encode!(%{text: text}))
+ else
+ Logger.debug(text)
end
end)
end
@@ -16,4 +14,12 @@ defmodule Plausible.Slack do
defp webhook_url() do
Keyword.fetch!(Application.get_env(:plausible, :slack), :webhook)
end
+
+ defp env() do
+ Application.get_env(:plausible, :environment)
+ end
+
+ defp self_hosted() do
+ Application.get_env(:plausible, :is_selfhost)
+ end
end