Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
ffed1a4a
Unverified
Commit
ffed1a4a
authored
Jan 20, 2023
by
neil
Committed by
GitHub
Jan 20, 2023
Browse files
Merge pull request #4468 from DreamOfIce/master
Update deploy script for gcore
parents
577f4e0c
1bfd3642
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy/gcore_cdn.sh
View file @
ffed1a4a
#!/usr/bin/env sh
# Here is the script to deploy the cert to G-Core CDN service (https://gcore
labs
.com/
ru/
) using the G-Core Labs API (https://docs.gcore
labs
.com/cdn
/
).
# Here is the script to deploy the cert to G-Core CDN service (https://gcore.com/) using the G-Core Labs API (https://
api
docs.gcore.com/cdn).
# Returns 0 when success.
#
# Written by temoffey <temofffey@gmail.com>
# Public domain, 2019
# Update by DreamOfIce <admin@dreamofice.cn> in 2023
#export DEPLOY_GCORE_CDN_USERNAME=myusername
#export DEPLOY_GCORE_CDN_PASSWORD=mypassword
...
...
@@ -56,7 +57,7 @@ gcore_cdn_deploy() {
_request
=
"{
\"
username
\"
:
\"
$Le_Deploy_gcore_cdn_username
\"
,
\"
password
\"
:
\"
$Le_Deploy_gcore_cdn_password
\"
}"
_debug _request
"
$_request
"
export
_H1
=
"Content-Type:application/json"
_response
=
$(
_post
"
$_request
"
"https://api.gc
dn
.co/auth/jwt/login"
)
_response
=
$(
_post
"
$_request
"
"https://api.gc
ore
.co
m
/auth/jwt/login"
)
_debug _response
"
$_response
"
_regex
=
".*
\"
access
\"
:
\"\(
[-._0-9A-Za-z]*
\)\"
.*$"
_debug _regex
"
$_regex
"
...
...
@@ -69,8 +70,8 @@ gcore_cdn_deploy() {
fi
_info
"Find CDN resource with cname
$_cdomain
"
export
_H2
=
"Authorization:
Token
$_token
"
_response
=
$(
_get
"https://api.gc
dn.co
/resources"
)
export
_H2
=
"Authorization:
Bearer
$_token
"
_response
=
$(
_get
"https://api.gc
ore.com/cdn
/resources"
)
_debug _response
"
$_response
"
_regex
=
"
\"
primary_resource
\"
:null},"
_debug _regex
"
$_regex
"
...
...
@@ -102,7 +103,7 @@ gcore_cdn_deploy() {
_date
=
$(
date
"+%d.%m.%Y %H:%M:%S"
)
_request
=
"{
\"
name
\"
:
\"
$_cdomain
(
$_date
)
\"
,
\"
sslCertificate
\"
:
\"
$_fullchain
\"
,
\"
sslPrivateKey
\"
:
\"
$_key
\"
}"
_debug _request
"
$_request
"
_response
=
$(
_post
"
$_request
"
"https://api.gc
dn.co
/sslData"
)
_response
=
$(
_post
"
$_request
"
"https://api.gc
ore.com/cdn
/sslData"
)
_debug _response
"
$_response
"
_regex
=
".*
\"
id
\"
:
\(
[0-9]*
\)
.*$"
_debug _regex
"
$_regex
"
...
...
@@ -117,7 +118,7 @@ gcore_cdn_deploy() {
_info
"Update CDN resource"
_request
=
"{
\"
originGroup
\"
:
$_originGroup
,
\"
sslData
\"
:
$_sslDataAdd
}"
_debug _request
"
$_request
"
_response
=
$(
_post
"
$_request
"
"https://api.gc
dn.co
/resources/
$_resourceId
"
''
"PUT"
)
_response
=
$(
_post
"
$_request
"
"https://api.gc
ore.com/cdn
/resources/
$_resourceId
"
''
"PUT"
)
_debug _response
"
$_response
"
_regex
=
".*
\"
sslData
\"
:
\(
[0-9]*
\)
.*$"
_debug _regex
"
$_regex
"
...
...
@@ -133,7 +134,7 @@ gcore_cdn_deploy() {
_info
"Not found old SSL certificate"
else
_info
"Delete old SSL certificate"
_response
=
$(
_post
''
"https://api.gc
dn.co
/sslData/
$_sslDataOld
"
''
"DELETE"
)
_response
=
$(
_post
''
"https://api.gc
ore.com/cdn
/sslData/
$_sslDataOld
"
''
"DELETE"
)
_debug _response
"
$_response
"
fi
...
...
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