support other ntfy instances
This commit is contained in:
parent
34474a01b6
commit
f4adaa7b4e
|
@ -1,3 +1,4 @@
|
||||||
import Config
|
import Config
|
||||||
config :gh2ntfy, topic: System.get_env("GH2NTFY_TOPIC")
|
config :gh2ntfy, topic: System.get_env("GH2NTFY_TOPIC")
|
||||||
config :gh2ntfy, token: System.get_env("GH2NTFY_GITHUB_TOKEN")
|
config :gh2ntfy, token: System.get_env("GH2NTFY_GITHUB_TOKEN")
|
||||||
|
config :gh2ntfy, instance: System.get_env("GH2NTFY_INSTANCE")
|
||||||
|
|
|
@ -17,10 +17,10 @@ defmodule Gh2ntfy.Ntfyer do
|
||||||
@impl true
|
@impl true
|
||||||
def handle_cast({:send_notif, title, body, headers}, topic) do
|
def handle_cast({:send_notif, title, body, headers}, topic) do
|
||||||
Logger.info("sending notification with title '#{title}'")
|
Logger.info("sending notification with title '#{title}'")
|
||||||
# TODO: allow other ntfy instances
|
|
||||||
Finch.build(
|
Finch.build(
|
||||||
:post,
|
:post,
|
||||||
"https://ntfy.sh/" <> topic,
|
"https://" <> Application.fetch_env!(:gh2ntfy, :instance) <> "/" <> topic,
|
||||||
[
|
[
|
||||||
{"Title", title}
|
{"Title", title}
|
||||||
] ++ headers,
|
] ++ headers,
|
||||||
|
|
Loading…
Reference in a new issue