[wip] There should be a plugin approach for output

This commit is contained in:
alban 2020-05-16 02:38:09 +02:00
parent 756cc3957a
commit e77830a144
3 changed files with 52 additions and 18 deletions

View file

@ -0,0 +1,15 @@
#!/bin/bash
HOOKS_OUTPUT+=( hookOutputChangelogServer )
CHANGELOG_SERVER=http://localhost:3000
hookOutputChangelogServer(){
[[ -z "$1" ]] && echo "Sending changelog to remote server" && return
CONTENT=$(jq -aRs . $1|tr '"' '\"')
PAYLOAD="{\"author\":\"$CHANGELOG_USERNAME\",\"server\":\"$(hostname -f)\",\"content\":${CONTENT}}"
URL=$( curl -X POST -H "Content-Type: application/json" -s -d "${PAYLOAD}" "$CHANGELOG_SERVER/changelog/_doc"; )
echo "$FILE: $URL" >> $TMP
}