Skip to content

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

Configure webhook in secret

Uku Taht9a53c776d9a0
diff --git a/config/prod.exs b/config/prod.exs
index 49dc938641..31ea437666 100644
--- a/config/prod.exs
+++ b/config/prod.exs
@@ -83,6 +83,9 @@ config :plausible, :google,
client_id: System.get_env("GOOGLE_CLIENT_ID"),
client_secret: System.get_env("GOOGLE_CLIENT_SECRET")
+config :plausible, :slack,
+ webhook: System.get_env("SLACK_WEBHOOK")
+
config :plausible, Plausible.Mailer,
adapter: Bamboo.PostmarkAdapter,
api_key: System.get_env("POSTMARK_API_KEY")
diff --git a/lib/plausible/slack.ex b/lib/plausible/slack.ex
index daea6fea07..c0891ae29b 100644
--- a/lib/plausible/slack.ex
+++ b/lib/plausible/slack.ex
@@ -1,16 +1,19 @@
defmodule Plausible.Slack do
@app_env System.get_env("APP_ENV") || "dev"
- @feed_channel_url "https://hooks.slack.com/services/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"
require Logger
def notify(text) do
Task.start(fn ->
case @app_env do
"prod" ->
- HTTPoison.post!(@feed_channel_url, Poison.encode!(%{text: text}))
+ HTTPoison.post!(webhook_url(), Poison.encode!(%{text: text}))
_ ->
Logger.debug(text)
end
end)
end
+
+ defp webhook_url() do
+ Keyword.fetch!(Application.get_env(:plausible, :slack), :webhook)
+ end
end