summaryrefslogtreecommitdiff
path: root/curl.sh
diff options
context:
space:
mode:
Diffstat (limited to 'curl.sh')
-rwxr-xr-xcurl.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/curl.sh b/curl.sh
new file mode 100755
index 0000000..412192c
--- /dev/null
+++ b/curl.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -eu
+
+runcurl() {
+ ./mktoken > token
+ curl -s -H "Authorization: Bearer $(cat token)" "$@"
+}
+
+cmd="$1"
+shift 1
+
+case "$cmd" in
+ update-repo)
+ runcurl -X POST --data-binary @hithere.json \
+ -H "Content-Type: application/json" \
+ https://wmf2-vcsworker.vm.liw.fi/updaterepo
+ ;;
+
+ upload-blob)
+ runcurl -X PUT --data-binary @"$1" \
+ -H "Content-Type: application/octet-stream" \
+ https://wmf2-artifacts.vm.liw.fi/blobs/"$2"
+ ;;
+
+ get-blob)
+ runcurl -X GET https://wmf2-artifacts.vm.liw.fi/blobs/"$1"
+ ;;
+
+ *)
+ echo "eek" 1>&2
+ exit 1
+ ;;
+esac