3 # Official DNS API for Nanelo.com
5 # Provide the required API Key like this:
6 # NANELO_TOKEN="FmD408PdqT1E269gUK57"
8 NANELO_API
="https://api.nanelo.com/v1/"
10 ######## Public functions #####################
12 # Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
17 NANELO_TOKEN
="${NANELO_TOKEN:-$(_readaccountconf_mutable NANELO_TOKEN)}"
18 if [ -z "$NANELO_TOKEN" ]; then
20 _err
"You didn't configure a Nanelo API Key yet."
21 _err
"Please set NANELO_TOKEN and try again."
22 _err
"Login to Nanelo.com and go to Settings > API Keys to get a Key"
25 _saveaccountconf_mutable NANELO_TOKEN
"$NANELO_TOKEN"
27 _info
"Adding TXT record to ${fulldomain}"
28 response
="$(_get "$NANELO_API$NANELO_TOKEN/dns
/addrecord?
type=TXT
&ttl
=60&name
=${fulldomain}&value
=${txtvalue}")"
29 if _contains
"${response}" 'success'; then
32 _err
"Could not create resource record, please check the logs"
41 NANELO_TOKEN
="${NANELO_TOKEN:-$(_readaccountconf_mutable NANELO_TOKEN)}"
42 if [ -z "$NANELO_TOKEN" ]; then
44 _err
"You didn't configure a Nanelo API Key yet."
45 _err
"Please set NANELO_TOKEN and try again."
46 _err
"Login to Nanelo.com and go to Settings > API Keys to get a Key"
49 _saveaccountconf_mutable NANELO_TOKEN
"$NANELO_TOKEN"
51 _info
"Deleting resource record $fulldomain"
52 response
="$(_get "$NANELO_API$NANELO_TOKEN/dns
/deleterecord?
type=TXT
&ttl
=60&name
=${fulldomain}&value
=${txtvalue}")"
53 if _contains
"${response}" 'success'; then
56 _err
"Could not delete resource record, please check the logs"