15 lines
386 B
Bash
15 lines
386 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
# lego generates proper absolute fqdn with trailing dot. API expects one without it
|
||
|
FQDN="${2::-1}"
|
||
|
CHALLENGE="$3"
|
||
|
|
||
|
case $1 in
|
||
|
present)
|
||
|
curl "$API_URL/api/1/add?token=$API_TOKEN&record=$FQDN:TXT&value=\"$CHALLENGE\"" ;;
|
||
|
cleanup)
|
||
|
curl "$API_URL/api/1/delete?token=$API_TOKEN&record=$FQDN:TXT" ;;
|
||
|
timeout)
|
||
|
echo '{"timeout": 240, "interval": 5}' ;;
|
||
|
esac
|