Skip to content

Commit

Permalink
missing curl in container and simpler env args
Browse files Browse the repository at this point in the history
  • Loading branch information
Echsecutor committed Aug 19, 2020
1 parent e00d2f4 commit 7e68a9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.8-alpine

RUN apk --no-cache --update add bash inotify-tools
RUN apk --no-cache --update add bash inotify-tools curl

WORKDIR /usr/src/app

Expand Down
12 changes: 9 additions & 3 deletions auto-hash-folder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ inotifywait -m $WHATCH_DIR -e create -e moved_to |

if [[ "$POST_BINARY_URL" != "" ]]; then
echo -e "[...]\t Posting binary hashes to $POST_BINARY_URL"
EXIT_STATUS=0
while read -r line; do
python3 -c "import binascii; import sys; sys.stdout.buffer.write(binascii.unhexlify(\"${line:14:64}\"));" | \
curl -i --data-binary "@-" $POST_BINARY_HEADERS $POST_BINARY_URL
python3 -c "import binascii; import sys; sys.stdout.buffer.write(binascii.unhexlify(\"${line:14:64}\"));" |
curl -s -i --data-binary "@-" --header "Content-Type: application/octet-stream" --header "X-Auth-Token: $POST_X_ATUH" "$POST_BINARY_URL" ||
EXIT_STATUS=$?
done <$out_file_path
echo -e "[done]\t posted."
if [[ "$EXIT_STATUS" == "0" ]]; then
echo -e "[done]\t posted."
else
echo -e "[ERR]\t some hash posting failed."
fi
fi

else
Expand Down

0 comments on commit 7e68a9c

Please sign in to comment.