Browse Source

To work in cronjob

${_domain} was empty in cronjob. Replace it by fulldomain without _acme-challenge. at begin string.

Now CronJob works perfectly excellent for me. Thanks all.
pull/2964/head
Vitaly Kireev 6 years ago
committed by GitHub
parent
commit
4d32b7e6ae
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dnsapi/dns_regru.sh

8
dnsapi/dns_regru.sh

@ -14,6 +14,8 @@ REGRU_API_URL="https://api.reg.ru/api/regru2"
dns_regru_add() { dns_regru_add() {
fulldomain=$1 fulldomain=$1
txtvalue=$2 txtvalue=$2
mydomain=${fulldomain#*_acme-challenge.}
_info "Name of domain ${mydomain}"
REGRU_API_Username="${REGRU_API_Username:-$(_readaccountconf_mutable REGRU_API_Username)}" REGRU_API_Username="${REGRU_API_Username:-$(_readaccountconf_mutable REGRU_API_Username)}"
REGRU_API_Password="${REGRU_API_Password:-$(_readaccountconf_mutable REGRU_API_Password)}" REGRU_API_Password="${REGRU_API_Password:-$(_readaccountconf_mutable REGRU_API_Password)}"
@ -28,7 +30,7 @@ dns_regru_add() {
_saveaccountconf_mutable REGRU_API_Password "$REGRU_API_Password" _saveaccountconf_mutable REGRU_API_Password "$REGRU_API_Password"
_info "Adding TXT record to ${fulldomain}" _info "Adding TXT record to ${fulldomain}"
response="$(_get "$REGRU_API_URL/zone/add_txt?input_data={%22username%22:%22${REGRU_API_Username}%22,%22password%22:%22${REGRU_API_Password}%22,%22domains%22:[{%22dname%22:%22${_domain}%22}],%22subdomain%22:%22_acme-challenge%22,%22text%22:%22${txtvalue}%22,%22output_content_type%22:%22plain%22}&input_format=json")"
response="$(_get "$REGRU_API_URL/zone/add_txt?input_data={%22username%22:%22${REGRU_API_Username}%22,%22password%22:%22${REGRU_API_Password}%22,%22domains%22:[{%22dname%22:%22${mydomain}%22}],%22subdomain%22:%22_acme-challenge%22,%22text%22:%22${txtvalue}%22,%22output_content_type%22:%22plain%22}&input_format=json")"
if _contains "${response}" 'success'; then if _contains "${response}" 'success'; then
return 0 return 0
@ -41,6 +43,8 @@ dns_regru_add() {
dns_regru_rm() { dns_regru_rm() {
fulldomain=$1 fulldomain=$1
txtvalue=$2 txtvalue=$2
mydomain=${fulldomain#*_acme-challenge.}
_info "Name of domain ${mydomain}"
REGRU_API_Username="${REGRU_API_Username:-$(_readaccountconf_mutable REGRU_API_Username)}" REGRU_API_Username="${REGRU_API_Username:-$(_readaccountconf_mutable REGRU_API_Username)}"
REGRU_API_Password="${REGRU_API_Password:-$(_readaccountconf_mutable REGRU_API_Password)}" REGRU_API_Password="${REGRU_API_Password:-$(_readaccountconf_mutable REGRU_API_Password)}"
@ -52,7 +56,7 @@ dns_regru_rm() {
fi fi
_info "Deleting resource record $fulldomain" _info "Deleting resource record $fulldomain"
response="$(_get "$REGRU_API_URL/zone/remove_record?input_data={%22username%22:%22${REGRU_API_Username}%22,%22password%22:%22${REGRU_API_Password}%22,%22domains%22:[{%22dname%22:%22${_domain}%22}],%22subdomain%22:%22_acme-challenge%22,%22content%22:%22${txtvalue}%22,%22record_type%22:%22TXT%22,%22output_content_type%22:%22plain%22}&input_format=json")"
response="$(_get "$REGRU_API_URL/zone/remove_record?input_data={%22username%22:%22${REGRU_API_Username}%22,%22password%22:%22${REGRU_API_Password}%22,%22domains%22:[{%22dname%22:%22${mydomain}%22}],%22subdomain%22:%22_acme-challenge%22,%22content%22:%22${txtvalue}%22,%22record_type%22:%22TXT%22,%22output_content_type%22:%22plain%22}&input_format=json")"
if _contains "${response}" 'success'; then if _contains "${response}" 'success'; then
return 0 return 0

Loading…
Cancel
Save