crazy-max/diun

Clarify usage of SIGNALREST_RECIPIENTS_<KEY> variables

phipolis opened this issue · 2 comments

Description

The configuration of the Signal-REST notifier by environment variables specifies DIUN_NOTIF_SIGNALREST_RECIPIENTS_<KEY>, but it's unclear what the requirements are for <key>. Is that an index, like 1,2,3...? Or any unique value? And does that key need to be referenced somewhere else?

I looked for other notifiers using a similar dynamic key and tried to understand from the source how it's parsed, but I'm still unsure. Could the docs clarify how to define the recipients in environment variables?

Thank you!

but it's unclear what the requirements are for <key>.

Yes agree, <index> would be better. In your case:

  • DIUN_NOTIF_SIGNALREST_RECIPIENTS_0
  • DIUN_NOTIF_SIGNALREST_RECIPIENTS_1
  • ...

@crazy-max The recipients variables don't seem to be getting picked up as intended. I set the environment variable in docker compose as:

environment:
  - "DIUN_NOTIF_SIGNALREST_ENDPOINT=http://redacted/v2/send"
  - "DIUN_NOTIF_SIGNALREST_NUMBER=+redacted"
  - "DIUN_NOTIF_SIGNALREST_RECIPIENTS_0=+redacted"
  - "DIUN_NOTIF_SIGNALREST_TEMPLATEBODY=Docker tag {{ .Entry.Image }} has been released."

Signal-REST container logged a 400 response when I ran diun notif test. I initially couldn't tell what was going wrong, but tcpdump shined some light:

{"message":"Docker tag docker.io/diun/testnotif:latest has been released.",
 "number":"+redacted",
 "recipients":null}

HTTP/1.1 400 Bad Request
{"error":"Couldn't process request - please provide at least one recipient"}

I did find that using DIUN_NOTIF_SIGNALREST_RECIPIENTS=+redacted does work for a single recipient, resulting in "recipients":["+redacted"] in the request.

Also request: It would be helpful for troubleshooting if the signalrest notifier logged the body of 400 responses.