Browse Source

Merge pull request #6728 from jwaterwater/feat/qiniu-force-https-config

Feat/qiniu force https config
pull/6602/merge
neil 1 week ago
committed by GitHub
parent
commit
06d9ca61a3
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      deploy/qiniu.sh

10
deploy/qiniu.sh

@ -8,6 +8,8 @@
# export QINIU_CDN_DOMAIN="cdn.example.com" # export QINIU_CDN_DOMAIN="cdn.example.com"
# If you have more than one domain, just # If you have more than one domain, just
# export QINIU_CDN_DOMAIN="cdn1.example.com cdn2.example.com" # export QINIU_CDN_DOMAIN="cdn1.example.com cdn2.example.com"
# Optional: force HTTPS redirect (default: false)
# export QINIU_FORCE_HTTPS="true"
QINIU_API_BASE="https://api.qiniu.com" QINIU_API_BASE="https://api.qiniu.com"
@ -44,6 +46,12 @@ qiniu_deploy() {
QINIU_CDN_DOMAIN="$_cdomain" QINIU_CDN_DOMAIN="$_cdomain"
fi fi
if [ -z "$QINIU_FORCE_HTTPS" ]; then
QINIU_FORCE_HTTPS="false"
else
_savedomainconf QINIU_FORCE_HTTPS "$QINIU_FORCE_HTTPS"
fi
## upload certificate ## upload certificate
string_fullchain=$(sed 's/$/\\n/' "$_cfullchain" | tr -d '\n') string_fullchain=$(sed 's/$/\\n/' "$_cfullchain" | tr -d '\n')
string_key=$(sed 's/$/\\n/' "$_ckey" | tr -d '\n') string_key=$(sed 's/$/\\n/' "$_ckey" | tr -d '\n')
@ -69,7 +77,7 @@ qiniu_deploy() {
_debug certId "$_certId" _debug certId "$_certId"
## update domain ssl config ## update domain ssl config
update_body="{\"certid\":$_certId,\"forceHttps\":false}"
update_body="{\"certid\":$_certId,\"forceHttps\":$QINIU_FORCE_HTTPS}"
for domain in $QINIU_CDN_DOMAIN; do for domain in $QINIU_CDN_DOMAIN; do
update_path="/domain/$domain/httpsconf" update_path="/domain/$domain/httpsconf"
update_access_token="$(_make_access_token "$update_path")" update_access_token="$(_make_access_token "$update_path")"

Loading…
Cancel
Save