Browse Source

Add hostname to notify script

pull/1/head
Julien Escario 4 years ago
parent
commit
c8c0a5cec5
  1. 4
      acme.sh/notify/rocketchat.sh

4
acme.sh/notify/rocketchat.sh

@ -9,6 +9,8 @@ rocketchat_send() {
_statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped _statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped
_debug "_statusCode" "$_statusCode" _debug "_statusCode" "$_statusCode"
_hostname=`hostname -f`
ROCKETCHAT_WEBHOOK_URL="${ROCKETCHAT_WEBHOOK_URL:-$(_readaccountconf_mutable ROCKETCHAT_WEBHOOK_URL)}" ROCKETCHAT_WEBHOOK_URL="${ROCKETCHAT_WEBHOOK_URL:-$(_readaccountconf_mutable ROCKETCHAT_WEBHOOK_URL)}"
if [ -z "$ROCKETCHAT_WEBHOOK_URL" ]; then if [ -z "$ROCKETCHAT_WEBHOOK_URL" ]; then
ROCKETCHAT_WEBHOOK_URL="" ROCKETCHAT_WEBHOOK_URL=""
@ -19,7 +21,7 @@ rocketchat_send() {
_saveaccountconf_mutable ROCKETCHAT_WEBHOOK_URL "$ROCKETCHAT_WEBHOOK_URL" _saveaccountconf_mutable ROCKETCHAT_WEBHOOK_URL "$ROCKETCHAT_WEBHOOK_URL"
export _H1="Content-Type: application/json" export _H1="Content-Type: application/json"
_content="$(printf "*%s*\n%s" "$_subject" "$_content" | _json_encode)"
_content="$(printf "*%s*\n%s" "$_subject on $_hostname" "$_content" | _json_encode)"
_data="{\"text\": \"$_content\" }" _data="{\"text\": \"$_content\" }"
response="$(_post "$_data" "$ROCKETCHAT_WEBHOOK_URL")" response="$(_post "$_data" "$ROCKETCHAT_WEBHOOK_URL")"

Loading…
Cancel
Save