25 lines
551 B
Bash
Executable file
25 lines
551 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
BODY="$1"
|
|
TITLE=${2:-Notification}
|
|
JQ_EXPR=${3:-.}
|
|
TYPE=${4:-matrix}
|
|
# TOKEN="$(cat ~/.config/notify/token)"
|
|
# TOKEN="$(cat /run/agenix/notify-token)"
|
|
TOKEN="$(cat token)"
|
|
URL="https://notify.fricloud.dk/notify"
|
|
# URL="||URL||"
|
|
|
|
# get stdin if needed
|
|
if [ "$BODY" = "-" ]; then
|
|
BODY="$(cat -)"
|
|
fi
|
|
|
|
# make request
|
|
curl -H "Authorization: Bearer $TOKEN" "$URL" \
|
|
--get \
|
|
--data-urlencode "title=$TITLE" \
|
|
--data-urlencode "body=$BODY" \
|
|
--data-urlencode "jq=$JQ_EXPR" \
|
|
--data-urlencode "type=$TYPE"
|
|
|