mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-26 23:11:44 +00:00
fixed to use _post function instead of curl
This commit is contained in:
parent
6d64098288
commit
5f3cb9019b
@ -85,13 +85,13 @@ proxmoxve_deploy(){
|
|||||||
# Set to 700 since this file will contain the private key contents.
|
# Set to 700 since this file will contain the private key contents.
|
||||||
chmod 700 "$_proxmoxve_temp_data"
|
chmod 700 "$_proxmoxve_temp_data"
|
||||||
fi
|
fi
|
||||||
# Ugly. I hate putting heredocs inside functions because heredocs don't account
|
# Ugly. I hate putting heredocs inside functions because heredocs don't
|
||||||
# for whitespace correctly but it _does_ work and is several times cleaner
|
# account for whitespace correctly but it _does_ work and is several times
|
||||||
# than anything else I had here.
|
# cleaner than anything else I had here.
|
||||||
#
|
#
|
||||||
# This creates a temporary data file that curl will use as the data being
|
# This dumps the json payload to a variable that should be passable to the
|
||||||
# posted to the webserver.
|
# _psot function.
|
||||||
cat << HEREDOC > "$_proxmoxve_temp_data_file"
|
_json_payload=$(cat << HEREDOC
|
||||||
{
|
{
|
||||||
"certificates": "$(tr '\n' ':' < "$_cfullchain" | sed 's/:/\\n/g')",
|
"certificates": "$(tr '\n' ':' < "$_cfullchain" | sed 's/:/\\n/g')",
|
||||||
"key": "$(tr '\n' ':' < "$_ckey" |sed 's/:/\\n/g')",
|
"key": "$(tr '\n' ':' < "$_ckey" |sed 's/:/\\n/g')",
|
||||||
@ -100,24 +100,10 @@ proxmoxve_deploy(){
|
|||||||
"force":"1"
|
"force":"1"
|
||||||
}
|
}
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
)
|
||||||
# Push certificates to server.
|
# Push certificates to server.
|
||||||
#
|
export _HTTPS_INSECURE=1
|
||||||
# --insecure is to ignore certificate errors.
|
export ="Authorization: PVEAPIToken=${_proxmoxve_header_api_token}"
|
||||||
# --fail is to fail the script if the http return code is not 200.
|
_post "$_json_payload" "$_target_url"
|
||||||
if curl -X "POST" --header "Content-Type: application/json" \
|
|
||||||
--header "Authorization: PVEAPIToken=${_proxmoxve_header_api_token}" \
|
|
||||||
--data "@${_proxmoxve_temp_data_file}" \
|
|
||||||
--insecure --fail \
|
|
||||||
"${_target_url}"
|
|
||||||
then
|
|
||||||
_info "Successfully updated certificate for $_cdomain."
|
|
||||||
rm -r "$_proxmoxve_temp_data"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
_err "Unable to update certificate for $_cdomain."
|
|
||||||
rm -r "$_proxmoxve_temp_data"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user