mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-09 16:01:46 +00:00
cleanup according to styleguide / ShellCheck
This commit is contained in:
parent
5fac282ee0
commit
da7b1fb014
@ -7,6 +7,9 @@
|
||||
# Fixed by: @der-berni
|
||||
# Modified: 2020-04-07
|
||||
#
|
||||
# Use ONECOM_KeepCnameProxy to keep the CNAME DNS record
|
||||
# export ONECOM_KeepCnameProxy="1"
|
||||
#
|
||||
# export ONECOM_User="username"
|
||||
# export ONECOM_Password="password"
|
||||
#
|
||||
@ -56,14 +59,14 @@ dns_one_add() {
|
||||
|
||||
#Check if the TXT exists
|
||||
_dns_one_getrecord "TXT" "$subdomain" "$txtvalue"
|
||||
if [ ! -z "$id" ]; then
|
||||
if [ -n "$id" ]; then
|
||||
_info "$(__green "Txt record with the same value found. Skip adding.")"
|
||||
return 0
|
||||
fi
|
||||
|
||||
_dns_one_addrecord "TXT" "$subdomain" "$txtvalue"
|
||||
if [ -z "$id" ]; then
|
||||
_err "Add CNAME record error."
|
||||
_err "Add TXT record error."
|
||||
return 1
|
||||
else
|
||||
_info "$(__green "Added, OK ($id)")"
|
||||
@ -103,7 +106,7 @@ dns_one_rm() {
|
||||
else
|
||||
#Check if the CNAME exists
|
||||
_dns_one_getrecord "CNAME" "$_sub_domain" "$subdomain.$maindomain"
|
||||
if [ ! -z "$id" ]; then
|
||||
if [ -n "$id" ]; then
|
||||
_info "$(__red "Removing CNAME Proxy record: '$(__green "\"$_sub_domain\" => \"$subdomain.$maindomain\"")'")"
|
||||
_dns_one_delrecord "$id"
|
||||
fi
|
||||
@ -118,7 +121,6 @@ dns_one_rm() {
|
||||
fi
|
||||
|
||||
# delete entry
|
||||
|
||||
if _dns_one_delrecord "$id"; then
|
||||
_info "$(__green Removed, OK)"
|
||||
return 0
|
||||
@ -162,6 +164,7 @@ _dns_one_login() {
|
||||
|
||||
# get credentials
|
||||
ONECOM_KeepCnameProxy="${ONECOM_KeepCnameProxy:-$(_readaccountconf_mutable ONECOM_KeepCnameProxy)}"
|
||||
ONECOM_KeepCnameProxy="${ONECOM_KeepCnameProxy:-0}"
|
||||
ONECOM_User="${ONECOM_User:-$(_readaccountconf_mutable ONECOM_User)}"
|
||||
ONECOM_Password="${ONECOM_Password:-$(_readaccountconf_mutable ONECOM_Password)}"
|
||||
if [ -z "$ONECOM_User" ] || [ -z "$ONECOM_Password" ]; then
|
||||
@ -173,6 +176,7 @@ _dns_one_login() {
|
||||
fi
|
||||
|
||||
#save the api key and email to the account conf file.
|
||||
_saveaccountconf_mutable ONECOM_KeepCnameProxy "$ONECOM_KeepCnameProxy"
|
||||
_saveaccountconf_mutable ONECOM_User "$ONECOM_User"
|
||||
_saveaccountconf_mutable ONECOM_Password "$ONECOM_Password"
|
||||
|
||||
@ -225,7 +229,6 @@ _dns_one_getrecord() {
|
||||
id=$(printf -- "%s" "$response" | sed -n "s/.*{\"type\":\"dns_custom_records\",\"id\":\"\([^\"]*\)\",\"attributes\":{\"prefix\":\"${name}\",\"type\":\"${type}\",\"content\":\"${value}\",\"priority\":0,\"ttl\":600}.*/\1/p")
|
||||
fi
|
||||
if [ -z "$id" ]; then
|
||||
_err "Record not found."
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
|
Loading…
Reference in New Issue
Block a user