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
d58fb2bb
Unverified
Commit
d58fb2bb
authored
Oct 30, 2020
by
ma331
Committed by
GitHub
Oct 30, 2020
Browse files
Speedup for _get_root function
parent
812333e9
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_anx.sh
View file @
d58fb2bb
...
@@ -122,15 +122,13 @@ _anx_rest() {
...
@@ -122,15 +122,13 @@ _anx_rest() {
return
0
return
0
}
}
#_acme-challenge.www.domain.com
#returns
# _sub_domain=_acme-challenge.www
# _domain=domain.com
_get_root
()
{
_get_root
()
{
domain
=
$1
domain
=
$1
i
=
1
i
=
1
p
=
1
p
=
1
_anx_rest GET
"zone.json"
while
true
;
do
while
true
;
do
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
_debug h
"
$h
"
_debug h
"
$h
"
...
@@ -139,13 +137,6 @@ _get_root() {
...
@@ -139,13 +137,6 @@ _get_root() {
return
1
return
1
fi
fi
# Does a zone with that name exist?
_anx_rest GET
"zone.json/
$h
"
# shellcheck disable=SC2154
if
[
"
$code
"
-ne
200
]
;
then
continue
fi
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
;
then
if
_contains
"
$response
"
"
\"
name
\"
:
\"
$h
\"
"
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
1-
$p
)
_domain
=
$h
_domain
=
$h
...
...
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