lander/landerctl
Jef Roosens 97ed770166
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
feat: serve paste entries
2022-11-21 16:28:27 +01:00

18 lines
376 B
Bash
Executable file

#!/usr/bin/env sh
API_KEY=test
URL=http://localhost:18080
if [ "$1" = add ]; then
curl \
-XPOST \
-d "$2" \
-H "X-Api-Key: $API_KEY" \
"$URL/s/$3"
elif [ "$1" = get ]; then
curl -is "$URL/$2" | sed -En 's/^[lL]ocation: (.*)/\1/p'
elif [ "$1" = paste ]; then
curl --data-binary @"$2" -XPOST -H "X-Api-Key: $API_KEY" "$URL/p/"
fi