Add env variable to specify propagation delay.
This commit is contained in:
parent
4d6fc272ac
commit
4aa03ad93d
4 changed files with 6 additions and 4 deletions
|
@ -30,6 +30,7 @@ under the following locations respectively:
|
|||
|
||||
- DUCKDNS_DOMAIN: The domain to update, ex: DUCKDNS_DOMAIN=redxef for redxef.duckdns.org
|
||||
- DUCKDNS_TOKEN: Your duckdns api token
|
||||
- DUCKDNS_PROPAGATION_DELAY: Wait this many seconds after the TXT record was updated
|
||||
- LE_EMAIL: Your email for certificate related notifications
|
||||
|
||||
## SOURCE
|
||||
|
|
|
@ -3,15 +3,16 @@
|
|||
echo "certbot txt record: $CERTBOT_VALIDATION"
|
||||
|
||||
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=%s'
|
||||
result="$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$CERTBOT_VALIDATION" | curl -K -)"
|
||||
result="$(printf 'url=%s\n' "$baseurl" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$CERTBOT_VALIDATION" | curl -K -)"
|
||||
|
||||
# give some time for the record to update
|
||||
echo "waiting for txt record"
|
||||
for i in $(seq 0 60); do
|
||||
for _i in $(seq 0 60); do
|
||||
val="$(nslookup -type=TXT "$DUCKDNS_DOMAIN.duckdns.org" | grep "$DUCKDNS_DOMAIN.duckdns.org.*text.*=.*" | sed -n 's/.*"\([^"]*\)".*/\1/p')"
|
||||
echo "current txt record: $val"
|
||||
test "$val" = "$CERTBOT_VALIDATION" && break
|
||||
sleep 10
|
||||
done
|
||||
sleep "${DUCKDNS_PROPAGATION_DELAY:-0}"
|
||||
|
||||
test "$result" = 'OK'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=&clear=True'
|
||||
test "$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" | curl -K -)" = 'OK'
|
||||
test "$(printf "url=%s\n" "$baseurl" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" | curl -K -)" = 'OK'
|
||||
|
|
2
duckdns
2
duckdns
|
@ -2,4 +2,4 @@
|
|||
|
||||
logfile=/var/log/duckdns.log
|
||||
baseurl='https://www.duckdns.org/update?domains=%s&token=%s'
|
||||
printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" | curl -o "$logfile" -K -
|
||||
printf 'url=%s\n' "$baseurl" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" | curl -o "$logfile" -K -
|
||||
|
|
Loading…
Reference in a new issue