Merge pull request #25 from clementnuss/optional-slack
fix: make slack integration optional when uri not specified
This commit is contained in:
commit
f556d0e5dd
|
@ -81,18 +81,22 @@ update=$(curl -s -X PATCH "https://api.cloudflare.com/client/v4/zones/$zone_iden
|
||||||
case "$update" in
|
case "$update" in
|
||||||
*"\"success\":false"*)
|
*"\"success\":false"*)
|
||||||
logger -s "DDNS Updater: $ip $record_name DDNS failed for $record_identifier ($ip). DUMPING RESULTS:\n$update"
|
logger -s "DDNS Updater: $ip $record_name DDNS failed for $record_identifier ($ip). DUMPING RESULTS:\n$update"
|
||||||
curl -L -X POST $slackuri \
|
if [[ $slackuri != "" ]]; then
|
||||||
--data-raw '{
|
curl -L -X POST $slackuri \
|
||||||
"channel": "'$slackchannel'",
|
--data-raw '{
|
||||||
"text" : "'"$slacksitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
|
"channel": "'$slackchannel'",
|
||||||
}'
|
"text" : "'"$slacksitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
|
||||||
|
}'
|
||||||
|
fi
|
||||||
exit 1;;
|
exit 1;;
|
||||||
*)
|
*)
|
||||||
logger "DDNS Updater: $ip $record_name DDNS updated."
|
logger "DDNS Updater: $ip $record_name DDNS updated."
|
||||||
curl -L -X POST $slackuri \
|
if [[ $slackuri != "" ]]; then
|
||||||
--data-raw '{
|
curl -L -X POST $slackuri \
|
||||||
"channel": "'$slackchannel'",
|
--data-raw '{
|
||||||
"text" : "'"$slacksitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
|
"channel": "'$slackchannel'",
|
||||||
}'
|
"text" : "'"$slacksitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
|
||||||
|
}'
|
||||||
|
fi
|
||||||
exit 0;;
|
exit 0;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue