Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
281ee1a8
Commit
281ee1a8
authored
Aug 26, 2020
by
Ed Lynes
Browse files
vetted by shfmt
parent
a0bf29e6
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_edgedns.sh
View file @
281ee1a8
...
...
@@ -68,12 +68,13 @@ dns_edgedns_add() {
_debug3
"existing TXT found"
_debug3
"record data"
"
$rdlist
"
# value already there?
if _contains
"
$rdlist
"
"
$txtvalue
"
; then
if _contains
"
$rdlist
"
"
$txtvalue
"
; then
return 0
fi
_txt_val=
""
while [
"
$_txt_val
"
!=
"
$rdlist
"
] && [
"
${
rdlist
}
"
]; do
_txt_val=
"
${
rdlist
%%,*
}
"
; rdlist=
"
${
rdlist
#*,
}
"
_txt_val=
"
${
rdlist
%%,*
}
"
rdlist=
"
${
rdlist
#*,
}
"
rdata=
"
${
rdata
}
,
\"
${
_txt_val
}
\"
"
done
fi
...
...
@@ -139,10 +140,11 @@ dns_edgedns_rm() {
rdata=
""
_txt_val=
""
while [
"
$_txt_val
"
!=
"
$rdlist
"
] && [
"
$rdlist
"
]; do
_txt_val=
"
${
rdlist
%%,*
}
"
; rdlist=
"
${
rdlist
#*,
}
"
_txt_val=
"
${
rdlist
%%,*
}
"
rdlist=
"
${
rdlist
#*,
}
"
_debug3
"_txt_val"
"
$_txt_val
"
_debug3
"txtvalue"
"
$txtvalue
"
if ! _contains
"
$_txt_val
"
"
$txtvalue
"
; then
if ! _contains
"
$_txt_val
"
"
$txtvalue
"
; then
rdata=
"
${
rdata
}${
comma
}
\"
${
_txt_val
}
\"
"
comma=
","
fi
...
...
@@ -244,7 +246,7 @@ _EDGEDNS_getZoneInfo() {
return
1
fi
fi
if
_contains
"
$curResult
"
"
\"
zone
\"
:"
;
then
if
_contains
"
$curResult
"
"
\"
zone
\"
:"
;
then
_debug2
"Zone data"
"
${
curResult
}
"
zone
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"
\"
zone
\"\\
s*:
\\
s*
\"
[^
\"
]*
\"
"
| _head_n 1 |
cut
-d
:
-f
2 |
tr
-d
"
\"
"
)
_debug3
"Zone"
"
${
zone
}
"
...
...
@@ -283,7 +285,7 @@ _edgedns_rest() {
# Set in acme.sh _post/_get
#_edgedns_headers="${_edgedns_headers}${tab}User-Agent:ACME DNSAPI Edge DNS version ${ACME_EDGEDNS_VERSION}"
_edgedns_headers
=
"
${
_edgedns_headers
}${
tab
}
Accept: application/json,*/*"
if
[
"
$m
"
!=
"GET"
]
&&
[
"
$m
"
!=
"DELETE"
]
;
then
if
[
"
$m
"
!=
"GET"
]
&&
[
"
$m
"
!=
"DELETE"
]
;
then
_edgedns_content_type
=
"application/json"
_debug3
"_request_body"
"
$_request_body
"
_body_len
=
$(
echo
"
$_request_body
"
|
tr
-d
"
\n\r
"
|
awk
'{print length}'
)
...
...
@@ -296,10 +298,11 @@ _edgedns_rest() {
work_header
=
"
${
_edgedns_headers
}${
tab
}
"
_debug3
"work_header"
"
$work_header
"
while
[
"
$work_header
"
]
;
do
entry
=
"
${
work_header
%%\\t*
}
"
;
work_header
=
"
${
work_header
#*\\t
}
"
entry
=
"
${
work_header
%%\\t*
}
"
work_header
=
"
${
work_header
#*\\t
}
"
export
"
$(
printf
"_H%s=%s"
"
$hdr_indx
"
"
$entry
"
)
"
_debug2
"Request Header "
"
$entry
"
hdr_indx
=
$((
hdr_indx
+
1
))
hdr_indx
=
$((
hdr_indx
+
1
))
done
# clear headers from previous request to avoid getting wrong http code on timeouts
...
...
@@ -444,5 +447,3 @@ _edgedns_base64_sha256() {
# filepath=$1
# section=$2
#}
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