From dc95ca7d1d8f270a6bd8dfae433619464a9f6a08 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Fri, 16 Dec 2022 19:28:39 -0500 Subject: [PATCH] Add base settings for now --- main.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) mode change 100644 => 100755 main.sh diff --git a/main.sh b/main.sh old mode 100644 new mode 100755 index 84d64a7..d27bed3 --- a/main.sh +++ b/main.sh @@ -2,4 +2,36 @@ # Main script # Here we will simply perform a ntfy hit to a nfty server +Priority=${PLUGIN_PRIORITY:-} +Title=${PLUGIN_TITLE:-} +Tags=${PLUGIN_TAGS:-} +Click=${PLUGIN_CLICK:-} +Attach=${PLUGIN_ATTACH:-} +Icon=${PLUGIN_ICON:-} + +URL=${PLUGIN_URL:-ntfy.sh} +Topic=${PLUGIN_TOPIC:-drone-notifications} +Message=${PLUGIN_MESSAGE:-Pipeline finished!} + +Username=${PLUGIN_USERNAME:-} +Password=${PLUGIN_PASSWORD:-} + +if [[ ! -z $Priority ]]; then + Priority="-H Priority:$Priority" +fi + +if [[ ! -z $Title ]]; then + Title="-H Title:$Title" +fi + +if [[ ! -z $Tags ]]; then + Tags="-H Tags:$Tags" +fi + +if [[ ! -z $Click ]]; then + Click="-H Click:$Click" +fi + +curl $Priority $Title $Tags $Click -u $Username:$Password -d "$Message" $URL/$Topic +#echo curl $Priority $Title $Tags $Click -u $Username:$Password -d "$Message" $URL/$Topic