format adjustment
This commit is contained in:
parent
c466f063c8
commit
bfba44fbad
@ -44,7 +44,7 @@ cachefly_deploy() {
|
|||||||
_debug CACHEFLY_TOKEN "$CACHEFLY_TOKEN"
|
_debug CACHEFLY_TOKEN "$CACHEFLY_TOKEN"
|
||||||
export _H1="Authorization: Bearer $CACHEFLY_TOKEN"
|
export _H1="Authorization: Bearer $CACHEFLY_TOKEN"
|
||||||
_response=$(_post "$_request_body" "$CACHEFLY_API_BASE/certificates" "" "POST" "application/json")
|
_response=$(_post "$_request_body" "$CACHEFLY_API_BASE/certificates" "" "POST" "application/json")
|
||||||
|
|
||||||
if _contains "$_response" "message"; then
|
if _contains "$_response" "message"; then
|
||||||
_err "Error in deploying $_cdomain certificate to CacheFly."
|
_err "Error in deploying $_cdomain certificate to CacheFly."
|
||||||
_err "$_response"
|
_err "$_response"
|
||||||
|
|||||||
@ -23,7 +23,7 @@ edgio_deploy() {
|
|||||||
_ccert="$3"
|
_ccert="$3"
|
||||||
_cca="$4"
|
_cca="$4"
|
||||||
_cfullchain="$5"
|
_cfullchain="$5"
|
||||||
|
|
||||||
_debug _cdomain "$_cdomain"
|
_debug _cdomain "$_cdomain"
|
||||||
_debug _ckey "$_ckey"
|
_debug _ckey "$_ckey"
|
||||||
_debug _ccert "$_ccert"
|
_debug _ccert "$_ccert"
|
||||||
@ -50,11 +50,11 @@ edgio_deploy() {
|
|||||||
else
|
else
|
||||||
_savedomainconf EDGIO_ENVIRONMENT_ID "$EDGIO_ENVIRONMENT_ID"
|
_savedomainconf EDGIO_ENVIRONMENT_ID "$EDGIO_ENVIRONMENT_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_info "Getting access token"
|
_info "Getting access token"
|
||||||
_data="client_id=$EDGIO_CLIENT_ID&client_secret=$EDGIO_CLIENT_SECRET&grant_type=client_credentials&scope=app.config"
|
_data="client_id=$EDGIO_CLIENT_ID&client_secret=$EDGIO_CLIENT_SECRET&grant_type=client_credentials&scope=app.config"
|
||||||
_debug Get_access_token_data "$_data"
|
_debug Get_access_token_data "$_data"
|
||||||
_response=$(_post "$_data" "https://id.edgio.app/connect/token" "" "POST" "application/x-www-form-urlencoded" )
|
_response=$(_post "$_data" "https://id.edgio.app/connect/token" "" "POST" "application/x-www-form-urlencoded")
|
||||||
_debug Get_access_token_response "$_response"
|
_debug Get_access_token_response "$_response"
|
||||||
_access_token=$(echo "$_response" | _json_decode | _egrep_o '"access_token":"[^"]*' | cut -d : -f 2 | tr -d '"')
|
_access_token=$(echo "$_response" | _json_decode | _egrep_o '"access_token":"[^"]*' | cut -d : -f 2 | tr -d '"')
|
||||||
_debug _access_token "$_access_token"
|
_debug _access_token "$_access_token"
|
||||||
|
|||||||
@ -92,8 +92,8 @@ keyhelp_deploy() {
|
|||||||
target_type=$(echo "$_response" | grep 'target_type' | grep 'checked' | sed -n 's/.*value="\([^"]*\).*/\1/p')
|
target_type=$(echo "$_response" | grep 'target_type' | grep 'checked' | sed -n 's/.*value="\([^"]*\).*/\1/p')
|
||||||
_debug "cert_value" "$cert_value"
|
_debug "cert_value" "$cert_value"
|
||||||
if [ -z "$cert_value" ]; then
|
if [ -z "$cert_value" ]; then
|
||||||
_err "Fail to get certificate id."
|
_err "Fail to get certificate id."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_request_body="submit=1&id=$DOMAIN_ID&target_type=$target_type&certificate_type=custom&certificate_id=$cert_value"
|
_request_body="submit=1&id=$DOMAIN_ID&target_type=$target_type&certificate_type=custom&certificate_id=$cert_value"
|
||||||
@ -101,8 +101,8 @@ keyhelp_deploy() {
|
|||||||
_message=$(echo "$_response" | grep -A 2 'message-body' | sed -n '/<div class="message-body ">/,/<\/div>/{//!p;}' | sed 's/<[^>]*>//g' | sed 's/^ *//;s/ *$//')
|
_message=$(echo "$_response" | grep -A 2 'message-body' | sed -n '/<div class="message-body ">/,/<\/div>/{//!p;}' | sed 's/<[^>]*>//g' | sed 's/^ *//;s/ *$//')
|
||||||
_info "_message" "$_message"
|
_info "_message" "$_message"
|
||||||
if [ -z "$_message" ]; then
|
if [ -z "$_message" ]; then
|
||||||
_err "Fail to apply certificate."
|
_err "Fail to apply certificate."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@ -48,14 +48,14 @@ netlify_deploy() {
|
|||||||
string_ccert=$(sed 's/$/\\n/' "$_ccert" | tr -d '\n')
|
string_ccert=$(sed 's/$/\\n/' "$_ccert" | tr -d '\n')
|
||||||
string_cca=$(sed 's/$/\\n/' "$_cca" | tr -d '\n')
|
string_cca=$(sed 's/$/\\n/' "$_cca" | tr -d '\n')
|
||||||
string_key=$(sed 's/$/\\n/' "$_ckey" | tr -d '\n')
|
string_key=$(sed 's/$/\\n/' "$_ckey" | tr -d '\n')
|
||||||
|
|
||||||
for SITE_ID in $Netlify_SITE_ID; do
|
for SITE_ID in $Netlify_SITE_ID; do
|
||||||
_request_body="{\"certificate\":\"$string_ccert\",\"key\":\"$string_key\",\"ca_certificates\":\"$string_cca\"}"
|
_request_body="{\"certificate\":\"$string_ccert\",\"key\":\"$string_key\",\"ca_certificates\":\"$string_cca\"}"
|
||||||
_debug _request_body "$_request_body"
|
_debug _request_body "$_request_body"
|
||||||
_debug Netlify_ACCESS_TOKEN "$Netlify_ACCESS_TOKEN"
|
_debug Netlify_ACCESS_TOKEN "$Netlify_ACCESS_TOKEN"
|
||||||
export _H1="Authorization: Bearer $Netlify_ACCESS_TOKEN"
|
export _H1="Authorization: Bearer $Netlify_ACCESS_TOKEN"
|
||||||
_response=$(_post "$_request_body" "https://api.netlify.com/api/v1/sites/$SITE_ID/ssl" "" "POST" "application/json")
|
_response=$(_post "$_request_body" "https://api.netlify.com/api/v1/sites/$SITE_ID/ssl" "" "POST" "application/json")
|
||||||
|
|
||||||
if _contains "$_response" "\"error\""; then
|
if _contains "$_response" "\"error\""; then
|
||||||
_err "Error in deploying $_cdomain certificate to Netlify SITE_ID $SITE_ID."
|
_err "Error in deploying $_cdomain certificate to Netlify SITE_ID $SITE_ID."
|
||||||
_err "$_response"
|
_err "$_response"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user