@ -36,33 +36,18 @@ dns_cx_add() {
return 1
fi
existing_records " $_domain " " $_sub_domain "
_debug count " $count "
if [ " $? " != "0" ] ; then
_err "Error get existing records."
return 1
fi
if [ " $count " = "0" ] ; then
add_record " $_domain " " $_sub_domain " " $txtvalue "
else
update_record " $_domain " " $_sub_domain " " $txtvalue "
fi
if [ " $? " = "0" ] ; then
return 0
fi
return 1
}
#fulldomain
#fulldomain txtvalue
dns_cx_rm( ) {
fulldomain = $1
txtvalue = $2
REST_API = " $CX_Api "
if _get_root " $fulldomain " ; then
record_id = ""
existing_records " $_domain " " $_sub_domain "
if ! [ " $record_id " = " " ] ; then
existing_records " $_domain " " $_sub_domain " " $txtvalue "
if [ " $record_id " ] ; then
_rest DELETE " record/ $record_id / $_domain_id " "{}"
_info " Deleted record ${ fulldomain } "
fi
@ -114,23 +99,6 @@ add_record() {
return 0
}
#update the txt record
#Usage: root sub txtvalue
update_record( ) {
root = $1
sub = $2
txtvalue = $3
fulldomain = " $sub . $root "
_info "Updating record"
if _rest PUT " record/ $record_id " " {\"domain_id\": $_domain_id , \"host\":\" $_sub_domain \", \"value\":\" $txtvalue \", \"type\":\"TXT\",\"ttl\":600, \"line_id\":1} " ; then
return 0
fi
return 1
}
#################### Private functions below ##################################
#_acme-challenge.www.domain.com
#returns