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
afdb9a63
Unverified
Commit
afdb9a63
authored
Jan 19, 2019
by
shonenada
Browse files
chore: replece `Le_Deploy_Qiniu_*` with `QINIU_*`
parent
4c1fa9c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/qiniu.sh
View file @
afdb9a63
...
@@ -23,38 +23,31 @@ qiniu_deploy() {
...
@@ -23,38 +23,31 @@ qiniu_deploy() {
_debug _cfullchain
"
$_cfullchain
"
_debug _cfullchain
"
$_cfullchain
"
if
[
-z
"
$QINIU_AK
"
]
;
then
if
[
-z
"
$QINIU_AK
"
]
;
then
if
[
-z
"
$Le_Deploy_Qiniu_AK
"
]
;
then
_err
"QINIU_AK is not defined."
_err
"QINIU_AK is not defined."
return
1
return
1
fi
else
else
Le_Deploy_Qiniu_AK
=
"
$QINIU_AK
"
_savedomainconf QINIU_AK
"
$QINIU_AK
"
_savedomainconf Le_Deploy_Qiniu_AK
"
$Le_Deploy_Qiniu_AK
"
fi
fi
if
[
-z
"
$QINIU_SK
"
]
;
then
if
[
-z
"
$QINIU_SK
"
]
;
then
if
[
-z
"
$Le_Deploy_Qiniu_SK
"
]
;
then
_err
"QINIU_SK is not defined."
_err
"QINIU_SK is not defined."
return
1
return
1
fi
else
else
Le_Deploy_Qiniu_SK
=
"
$QINIU_SK
"
_savedomainconf QINIU_SK
"
$QINIU_SK
"
_savedomainconf Le_Deploy_Qiniu_SK
"
$Le_Deploy_Qiniu_SK
"
fi
fi
Le_Deploy_Qiniu_Cdn_Domain
=
"
${
QINIU_CDN_DOMAIN
:-
$(
_readdomainconf Le_Deploy_Qiniu_Cdn_Domain
)
}
"
if
[
-z
"
$QINIU_CDN_DOMAIN
"
]
;
then
if
[
-z
"
$Le_Deploy_Qiniu_Cdn_Domain
"
]
;
then
QINIU_CDN_DOMAIN
=
"
$_cdomain
"
Le_Deploy_Qiniu_Cdn_Domain
=
"
$_cdomain
"
fi
fi
_savedomainconf
Le_Deploy_Qiniu_Cdn_Domain
"
$Le_Deploy_Qiniu_Cdn_Domain
"
_savedomainconf
QINIU_CDN_DOMAIN
"
$QINIU_CDN_DOMAIN
"
## 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'
)
sslcert_path
=
"/sslcert"
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
"
)
"
sslcert_access_token
=
"
$(
_make_access_token
"
$sslcert_path
"
)
"
_debug sslcert_access_token
"
$sslcert_access_token
"
_debug sslcert_access_token
"
$sslcert_access_token
"
export
_H1
=
"Authorization: QBox
$sslcert_access_token
"
export
_H1
=
"Authorization: QBox
$sslcert_access_token
"
...
@@ -74,7 +67,7 @@ qiniu_deploy() {
...
@@ -74,7 +67,7 @@ qiniu_deploy() {
_debug certId
"
$_certId
"
_debug certId
"
$_certId
"
## update domain ssl config
## 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_body
=
"{
\"
certid
\"
:
$_certId
,
\"
forceHttps
\"
:false}"
update_access_token
=
"
$(
_make_access_token
"
$update_path
"
)
"
update_access_token
=
"
$(
_make_access_token
"
$update_path
"
)
"
_debug update_access_token
"
$update_access_token
"
_debug update_access_token
"
$update_access_token
"
...
@@ -94,6 +87,6 @@ qiniu_deploy() {
...
@@ -94,6 +87,6 @@ qiniu_deploy() {
}
}
_make_access_token
()
{
_make_access_token
()
{
_token
=
"
$(
printf
"%s
\n
"
"
$1
"
| _hmac
"sha1"
"
$(
printf
"%s"
"
$
Le_Deploy_Qiniu
_SK
"
| _hex_dump |
tr
-d
" "
)
"
| _base64
)
"
_token
=
"
$(
printf
"%s
\n
"
"
$1
"
| _hmac
"sha1"
"
$(
printf
"%s"
"
$
QINIU
_SK
"
| _hex_dump |
tr
-d
" "
)
"
| _base64
)
"
echo
"
$
Le_Deploy_Qiniu
_AK
:
$_token
"
echo
"
$
QINIU
_AK
:
$_token
"
}
}
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