6b7b5caf54
Instead of using comments declare info in a special variable. Then the variable can be used to print the DNS API provider usage. The usage can be parsed on UI and show all needed inputs for options. The info is stored in plain string that it's both human-readable and easy to parse: dns_example_info='API name An extended description. Multiline. Domains: list of alternative domains to find Site: the dns provider website e.g. example.com Docs: Link to ACME.sh wiki for the provider Options: VARIABLE1 Title for the option1. VARIABLE2 Title for the option2. Default "default value". VARIABLE3 Title for the option3. Description to show on UI. Optional. Issues: Link to a support ticket on https://github.com/acmesh-official/acme.sh Author: First Lastname <authoremail@example.com>, Another Author <https://github.com/example>; ' Here: VARIABLE1 will be required. VARIABLE2 will be required too but will be populated with a "default value". VARIABLE3 is optional and can be empty. A DNS provider may have alternative options like CloudFlare may use API KEY or API Token. You can use a second section OptionsAlt: section. Some providers may have alternative names or domains e.g. Aliyun and AlibabaCloud. Add them to Domains: section. Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
69 lines
1.6 KiB
Bash
69 lines
1.6 KiB
Bash
#!/usr/bin/env sh
|
|
# shellcheck disable=SC2034
|
|
dns_tele3_info='tele3.cz
|
|
Site: tele3.cz
|
|
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#tele3
|
|
Options:
|
|
TELE3_Key API Key
|
|
TELE3_Secret API Secret
|
|
Author: Roman Blizik <https://github.com/par-pa>
|
|
'
|
|
|
|
TELE3_API="https://www.tele3.cz/acme/"
|
|
|
|
######## Public functions #####################
|
|
|
|
dns_tele3_add() {
|
|
_info "Using TELE3 DNS"
|
|
data="\"ope\":\"add\", \"domain\":\"$1\", \"value\":\"$2\""
|
|
if ! _tele3_call; then
|
|
_err "Publish zone failed"
|
|
return 1
|
|
fi
|
|
|
|
_info "Zone published"
|
|
}
|
|
|
|
dns_tele3_rm() {
|
|
_info "Using TELE3 DNS"
|
|
data="\"ope\":\"rm\", \"domain\":\"$1\", \"value\":\"$2\""
|
|
if ! _tele3_call; then
|
|
_err "delete TXT record failed"
|
|
return 1
|
|
fi
|
|
|
|
_info "TXT record successfully deleted"
|
|
}
|
|
|
|
#################### Private functions below ##################################
|
|
|
|
_tele3_init() {
|
|
TELE3_Key="${TELE3_Key:-$(_readaccountconf_mutable TELE3_Key)}"
|
|
TELE3_Secret="${TELE3_Secret:-$(_readaccountconf_mutable TELE3_Secret)}"
|
|
if [ -z "$TELE3_Key" ] || [ -z "$TELE3_Secret" ]; then
|
|
TELE3_Key=""
|
|
TELE3_Secret=""
|
|
_err "You must export variables: TELE3_Key and TELE3_Secret"
|
|
return 1
|
|
fi
|
|
|
|
#save the config variables to the account conf file.
|
|
_saveaccountconf_mutable TELE3_Key "$TELE3_Key"
|
|
_saveaccountconf_mutable TELE3_Secret "$TELE3_Secret"
|
|
}
|
|
|
|
_tele3_call() {
|
|
_tele3_init
|
|
data="{\"key\":\"$TELE3_Key\", \"secret\":\"$TELE3_Secret\", $data}"
|
|
|
|
_debug data "$data"
|
|
|
|
response="$(_post "$data" "$TELE3_API" "" "POST")"
|
|
_debug response "$response"
|
|
|
|
if [ "$response" != "success" ]; then
|
|
_err "$response"
|
|
return 1
|
|
fi
|
|
}
|