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
6132af8e
Commit
6132af8e
authored
Mar 26, 2020
by
ucando
Browse files
enable qiniu to deploy more than one domain
parent
bf0d513e
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/qiniu.sh
View file @
6132af8e
...
...
@@ -6,6 +6,8 @@
# export QINIU_AK="QINIUACCESSKEY"
# export QINIU_SK="QINIUSECRETKEY"
# export QINIU_CDN_DOMAIN="cdn.example.com"
# If you have more than one domain, just
# export QINIU_CDN_DOMAIN="cdn1.example.com cdn2.example.com"
QINIU_API_BASE
=
"https://api.qiniu.com"
...
...
@@ -67,21 +69,23 @@ qiniu_deploy() {
_debug certId
"
$_certId
"
## update domain ssl config
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
"
export
_H1
=
"Authorization: QBox
$update_access_token
"
update_response
=
$(
_post
"
$update_body
"
"
$QINIU_API_BASE$update_path
"
0
"PUT"
"application/json"
| _dbase64
"multiline"
)
if
_contains
"
$update_response
"
"error"
;
then
_err
"Error in updating domain httpsconf:"
_err
"
$update_response
"
return
1
fi
_debug update_response
"
$update_response
"
_info
"Certificate successfully deployed"
for
domain
in
$QINIU_CDN_DOMAIN
;
do
update_path
=
"/domain/
$domain
/httpsconf"
update_access_token
=
"
$(
_make_access_token
"
$update_path
"
)
"
_debug update_access_token
"
$update_access_token
"
export
_H1
=
"Authorization: QBox
$update_access_token
"
update_response
=
$(
_post
"
$update_body
"
"
$QINIU_API_BASE$update_path
"
0
"PUT"
"application/json"
| _dbase64
"multiline"
)
if
_contains
"
$update_response
"
"error"
;
then
_err
"Error in updating domain
$domain
httpsconf:"
_err
"
$update_response
"
return
1
fi
_debug update_response
"
$update_response
"
_info
"Domain
$domain
certificate has been deployed successfully"
done
return
0
}
...
...
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