chore: replece Le_Deploy_Qiniu_* with QINIU_*

This commit is contained in:
shonenada 2019-01-19 23:58:55 +08:00
parent 4c1fa9c242
commit afdb9a63ff
No known key found for this signature in database
GPG Key ID: 76A1B4666B0495CB

View File

@ -23,38 +23,31 @@ qiniu_deploy() {
_debug _cfullchain "$_cfullchain"
if [ -z "$QINIU_AK" ]; then
if [ -z "$Le_Deploy_Qiniu_AK" ]; then
_err "QINIU_AK is not defined."
return 1
fi
_err "QINIU_AK is not defined."
return 1
else
Le_Deploy_Qiniu_AK="$QINIU_AK"
_savedomainconf Le_Deploy_Qiniu_AK "$Le_Deploy_Qiniu_AK"
_savedomainconf QINIU_AK "$QINIU_AK"
fi
if [ -z "$QINIU_SK" ]; then
if [ -z "$Le_Deploy_Qiniu_SK" ]; then
_err "QINIU_SK is not defined."
return 1
fi
_err "QINIU_SK is not defined."
return 1
else
Le_Deploy_Qiniu_SK="$QINIU_SK"
_savedomainconf Le_Deploy_Qiniu_SK "$Le_Deploy_Qiniu_SK"
_savedomainconf QINIU_SK "$QINIU_SK"
fi
Le_Deploy_Qiniu_Cdn_Domain="${QINIU_CDN_DOMAIN:-$(_readdomainconf Le_Deploy_Qiniu_Cdn_Domain)}"
if [ -z "$Le_Deploy_Qiniu_Cdn_Domain" ]; then
Le_Deploy_Qiniu_Cdn_Domain="$_cdomain"
if [ -z "$QINIU_CDN_DOMAIN" ]; then
QINIU_CDN_DOMAIN="$_cdomain"
fi
_savedomainconf Le_Deploy_Qiniu_Cdn_Domain "$Le_Deploy_Qiniu_Cdn_Domain"
_savedomainconf QINIU_CDN_DOMAIN "$QINIU_CDN_DOMAIN"
## upload certificate
string_fullchain=$(sed 's/$/\\n/' "$_cfullchain" | tr -d '\n')
string_key=$(sed 's/$/\\n/' "$_ckey" | tr -d '\n')
sslcert_path="/sslcert"
sslcerl_body="{\"name\":\"$_cdomain\",\"common_name\":\"$Le_Deploy_Qiniu_Cdn_Domain\",\"ca\":\"$string_fullchain\",\"pri\":\"$string_key\"}"
sslcerl_body="{\"name\":\"$_cdomain\",\"common_name\":\"$QINIU_CDN_DOMAIN\",\"ca\":\"$string_fullchain\",\"pri\":\"$string_key\"}"
sslcert_access_token="$(_make_access_token "$sslcert_path")"
_debug sslcert_access_token "$sslcert_access_token"
export _H1="Authorization: QBox $sslcert_access_token"
@ -74,7 +67,7 @@ qiniu_deploy() {
_debug certId "$_certId"
## update domain ssl config
update_path="/domain/$Le_Deploy_Qiniu_Cdn_Domain/httpsconf"
update_path="/domain/$QINIU_CDN_DOMAIN/httpsconf"
update_body="{\"certid\":$_certId,\"forceHttps\":false}"
update_access_token="$(_make_access_token "$update_path")"
_debug update_access_token "$update_access_token"
@ -94,6 +87,6 @@ qiniu_deploy() {
}
_make_access_token() {
_token="$(printf "%s\n" "$1" | _hmac "sha1" "$(printf "%s" "$Le_Deploy_Qiniu_SK" | _hex_dump | tr -d " ")" | _base64)"
echo "$Le_Deploy_Qiniu_AK:$_token"
_token="$(printf "%s\n" "$1" | _hmac "sha1" "$(printf "%s" "$QINIU_SK" | _hex_dump | tr -d " ")" | _base64)"
echo "$QINIU_AK:$_token"
}