change to webhook env variables

This commit is contained in:
Owen
2025-01-10 12:32:33 +01:00
parent 84bbafb441
commit 529630b85d
+3 -3
View File
@@ -1,6 +1,4 @@
defmodule PlantIdDiscordBot.Metrics.Message do defmodule PlantIdDiscordBot.Metrics.Message do
@webhook_url Application.compile_env(:plantid_discord_bot, :metrics_webhook_url)
def start() do def start() do
PlantIdDiscordBot.Metrics.get_all() PlantIdDiscordBot.Metrics.get_all()
|> format_message() |> format_message()
@@ -33,12 +31,14 @@ defmodule PlantIdDiscordBot.Metrics.Message do
end end
def send_message(data) do def send_message(data) do
webhook_url = Application.get_env(:plantid_discord_bot, :metrics_webhook_url)
body = Jason.encode!(data) body = Jason.encode!(data)
headers = [ headers = [
{"Content-Type", "application/json"} {"Content-Type", "application/json"}
] ]
HTTPoison.post!(@webhook_url, body, headers) HTTPoison.post!(webhook_url, body, headers)
end end
end end