1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00
seirdy.one/scripts/get-token.sh

33 lines
614 B
Bash
Raw Normal View History

#!/bin/sh
#
# Script to authenticate with webmentiond and grab a temporary generated
# bearer token, writing it to .webmentiond-token for Hugo to then read.
set -e
_key() {
if [ -n "$BUILD_SUBMITTER" ]; then
cat ~/.webmentiond-key
else
pash show webmentiond-ci-key
fi
}
key="$(_key)"
set -u
# just a lil curl wrapper I use on seirdy.one
ccurl() {
curl --proto "=https" --proto-default https --tlsv1.3 --cert-status --compressed $*
}
_token() {
ccurl -sX POST https://seirdy.one/webmentions/authenticate/access-key -d "key=$key"
}
token="$(_token)"
set +u
printf '%s' "$token" >.webmentiond-token