Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
849a6c12
Commit
849a6c12
authored
Feb 13, 2018
by
neilpang
Browse files
fix for acme v2
parent
9144ce74
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_cx.sh
View file @
849a6c12
...
...
@@ -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
add_record
"
$_domain
"
"
$_sub_domain
"
"
$txtvalue
"
}
#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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment