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
a092a2fa
Unverified
Commit
a092a2fa
authored
May 03, 2022
by
Marvo2011
Committed by
GitHub
May 03, 2022
Browse files
Merge pull request #3 from AlvinSchiller/dev
Save domain dependent values in domain.conf
parents
d6c68f1a
227eac10
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_selfhost.sh
View file @
a092a2fa
...
@@ -12,23 +12,25 @@ dns_selfhost_add() {
...
@@ -12,23 +12,25 @@ dns_selfhost_add() {
_debug txtvalue
"
$txt
"
_debug txtvalue
"
$txt
"
SELFHOSTDNS_UPDATE_URL
=
"https://selfhost.de/cgi-bin/api.pl"
SELFHOSTDNS_UPDATE_URL
=
"https://selfhost.de/cgi-bin/api.pl"
# Get values, but don't save until we successfully validated
SELFHOSTDNS_USERNAME
=
"
${
SELFHOSTDNS_USERNAME
:-
$(
_readaccountconf_mutable SELFHOSTDNS_USERNAME
)
}
"
SELFHOSTDNS_USERNAME
=
"
${
SELFHOSTDNS_USERNAME
:-
$(
_readaccountconf_mutable SELFHOSTDNS_USERNAME
)
}
"
SELFHOSTDNS_PASSWORD
=
"
${
SELFHOSTDNS_PASSWORD
:-
$(
_readaccountconf_mutable SELFHOSTDNS_PASSWORD
)
}
"
SELFHOSTDNS_PASSWORD
=
"
${
SELFHOSTDNS_PASSWORD
:-
$(
_readaccountconf_mutable SELFHOSTDNS_PASSWORD
)
}
"
SELFHOSTDNS_MAP
=
"
${
SELFHOSTDNS_MAP
:-
$(
_readaccountconf_mutable SELFHOSTDNS_MAP
)
}
"
# These values are domain dependent, so read them from there
SELFHOSTDNS_RID
=
"
${
SELFHOSTDNS_RID
:-
$(
_readaccountconf_mutable SELFHOSTDNS_RID
)
}
"
_getdeployconf SELFHOSTDNS_MAP
SELFHOSTDNS_RID2
=
"
${
SELFHOSTDNS_RID2
:-
$(
_readaccountconf_mutable SELFHOSTDNS_RID2
)
}
"
_getdeployconf SELFHOSTDNS_RID
SELFHOSTDNS_LAST_SLOT
=
"
$(
_readaccountconf_mutable SELFHOSTDNS_LAST_SLOT
)
"
_getdeployconf SELFHOSTDNS_RID2
_getdeployconf SELFHOSTDNS_LAST_SLOT
if
[
-z
"
${
SELFHOSTDNS_USERNAME
:-}
"
]
||
[
-z
"
${
SELFHOSTDNS_PASSWORD
:-}
"
]
;
then
_err
"SELFHOSTDNS_USERNAME and SELFHOSTDNS_PASSWORD must be set"
return
1
fi
if
test
-z
"
$SELFHOSTDNS_LAST_SLOT
"
;
then
if
test
-z
"
$SELFHOSTDNS_LAST_SLOT
"
;
then
SELFHOSTDNS_LAST_SLOT
=
1
SELFHOSTDNS_LAST_SLOT
=
1
fi
fi
_saveaccountconf_mutable SELFHOSTDNS_USERNAME
"
$SELFHOSTDNS_USERNAME
"
_saveaccountconf_mutable SELFHOSTDNS_PASSWORD
"
$SELFHOSTDNS_PASSWORD
"
_saveaccountconf_mutable SELFHOSTDNS_MAP
"
$SELFHOSTDNS_MAP
"
_saveaccountconf_mutable SELFHOSTDNS_RID
"
$SELFHOSTDNS_RID
"
_saveaccountconf_mutable SELFHOSTDNS_RID2
"
$SELFHOSTDNS_RID2
"
rid
=
$(
echo
"
$SELFHOSTDNS_MAP
"
|
grep
-Eoi
"
$domain
:(
\d
+)"
|
tr
-d
"
$domain
:"
)
rid
=
$(
echo
"
$SELFHOSTDNS_MAP
"
|
grep
-Eoi
"
$domain
:(
\d
+)"
|
tr
-d
"
$domain
:"
)
if
test
-z
"
$rid
"
;
then
if
test
-z
"
$rid
"
;
then
...
@@ -41,7 +43,10 @@ dns_selfhost_add() {
...
@@ -41,7 +43,10 @@ dns_selfhost_add() {
fi
fi
fi
fi
_saveaccountconf_mutable SELFHOSTDNS_LAST_SLOT
"
$SELFHOSTDNS_LAST_SLOT
"
if
test
-z
"
$rid
"
;
then
_err
"SELFHOSTDNS_RID and SELFHOSTDNS_RID2, or SELFHOSTDNS_MAP must be set"
return
1
fi
_info
"Trying to add
$txt
on selfhost for rid:
$rid
"
_info
"Trying to add
$txt
on selfhost for rid:
$rid
"
...
@@ -52,6 +57,15 @@ dns_selfhost_add() {
...
@@ -52,6 +57,15 @@ dns_selfhost_add() {
_err
"Invalid response of acme-dns for selfhost"
_err
"Invalid response of acme-dns for selfhost"
return
1
return
1
fi
fi
# Now that we know the values are good, save them
_saveaccountconf_mutable SELFHOSTDNS_USERNAME
"
$SELFHOSTDNS_USERNAME
"
_saveaccountconf_mutable SELFHOSTDNS_PASSWORD
"
$SELFHOSTDNS_PASSWORD
"
# These values are domain dependent, so store them there
_savedeployconf SELFHOSTDNS_MAP
"
$SELFHOSTDNS_MAP
"
_savedeployconf SELFHOSTDNS_RID
"
$SELFHOSTDNS_RID
"
_savedeployconf SELFHOSTDNS_RID2
"
$SELFHOSTDNS_RID2
"
_savedeployconf SELFHOSTDNS_LAST_SLOT
"
$SELFHOSTDNS_LAST_SLOT
"
}
}
dns_selfhost_rm
()
{
dns_selfhost_rm
()
{
...
...
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