support other ntfy instances

This commit is contained in:
LordMZTE 2023-03-06 16:52:37 +01:00
parent 34474a01b6
commit f4adaa7b4e
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
2 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import Config
config :gh2ntfy, topic: System.get_env("GH2NTFY_TOPIC")
config :gh2ntfy, token: System.get_env("GH2NTFY_GITHUB_TOKEN")
config :gh2ntfy, instance: System.get_env("GH2NTFY_INSTANCE")

View File

@ -17,10 +17,10 @@ defmodule Gh2ntfy.Ntfyer do
@impl true
def handle_cast({:send_notif, title, body, headers}, topic) do
Logger.info("sending notification with title '#{title}'")
# TODO: allow other ntfy instances
Finch.build(
:post,
"https://ntfy.sh/" <> topic,
"https://" <> Application.fetch_env!(:gh2ntfy, :instance) <> "/" <> topic,
[
{"Title", title}
] ++ headers,