Extract configuration loading code to function
This commit is contained in:
parent
297859c5bc
commit
978ec91107
@ -14,13 +14,7 @@ dns_loopia_add() {
|
|||||||
fulldomain=$1
|
fulldomain=$1
|
||||||
txtvalue=$2
|
txtvalue=$2
|
||||||
|
|
||||||
LOOPIA_User="${LOOPIA_User:-$(_readaccountconf_mutable LOOPIA_User)}"
|
if ! _loopia_load_config; then
|
||||||
LOOPIA_Password="${LOOPIA_Password:-$(_readaccountconf_mutable LOOPIA_Password)}"
|
|
||||||
if [ -z "$LOOPIA_User" ] || [ -z "$LOOPIA_Password" ]; then
|
|
||||||
LOOPIA_User=""
|
|
||||||
LOOPIA_Password=""
|
|
||||||
_err "You don't specify loopia user and password yet."
|
|
||||||
_err "Please create you key and try again."
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -47,13 +41,7 @@ dns_loopia_rm() {
|
|||||||
fulldomain=$1
|
fulldomain=$1
|
||||||
txtvalue=$2
|
txtvalue=$2
|
||||||
|
|
||||||
LOOPIA_User="${LOOPIA_User:-$(_readaccountconf_mutable LOOPIA_User)}"
|
if ! _loopia_load_config; then
|
||||||
LOOPIA_Password="${LOOPIA_Password:-$(_readaccountconf_mutable LOOPIA_Password)}"
|
|
||||||
if [ -z "$LOOPIA_User" ] || [ -z "$LOOPIA_Password" ]; then
|
|
||||||
LOOPIA_User=""
|
|
||||||
LOOPIA_Password=""
|
|
||||||
_err "You don't specify LOOPIA user and password yet."
|
|
||||||
_err "Please create you key and try again."
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -96,6 +84,23 @@ dns_loopia_rm() {
|
|||||||
|
|
||||||
#################### Private functions below ##################################
|
#################### Private functions below ##################################
|
||||||
|
|
||||||
|
_loopia_load_config() {
|
||||||
|
LOOPIA_User="${LOOPIA_User:-$(_readaccountconf_mutable LOOPIA_User)}"
|
||||||
|
LOOPIA_Password="${LOOPIA_Password:-$(_readaccountconf_mutable LOOPIA_Password)}"
|
||||||
|
|
||||||
|
if [ -z "$LOOPIA_User" ] || [ -z "$LOOPIA_Password" ]; then
|
||||||
|
LOOPIA_User=""
|
||||||
|
LOOPIA_Password=""
|
||||||
|
|
||||||
|
_err "You don't specify loopia user and password yet."
|
||||||
|
_err "Please create you key and try again."
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
_loopia_get_records() {
|
_loopia_get_records() {
|
||||||
domain=$1
|
domain=$1
|
||||||
sub_domain=$2
|
sub_domain=$2
|
||||||
|
Loading…
Reference in New Issue
Block a user