Skip to content

Commit e9fe96f

Browse files
authored
feat: set download mirror location default to us (#33)
* feat: add mirror parameter
1 parent ffdc1a1 commit e9fe96f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/commands/setup.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ parameters:
66
type: string
77
description: Specify the version of the Serverless Framework CLI to install. By default, the latest version will be used.
88
default: ""
9+
mirror:
10+
type: enum
11+
enum:
12+
- us
13+
- cn
14+
default: us
15+
description: Select the geo-location for the download mirror. By default the value will be `us`, do not change if on CircleCI Cloud. Switch to `cn` for the China hosted mirror.
916
steps:
1017
- run:
1118
name: Install Serverless CLI
1219
environment:
1320
ORB_PARAM_SERVERLESS_VERSION: <<parameters.version>>
21+
ORB_PARAM_MIRROR: <<parameters.mirror>>
1422
command: <<include(scripts/install.sh)>>

src/scripts/install.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
2-
curl -o- -L https://slss.io/install | VERSION=$ORB_PARAM_SERVERLESS_VERSION bash
2+
export SLS_SCRIPT_URL="https://sls-standalone-sv-1300963013.cos.na-siliconvalley.myqcloud.com/install.sh"
3+
SLS_GEO_LOCATION=us
4+
if [ "$ORB_PARAM_MIRROR" = "cn" ]; then
5+
export SLS_SCRIPT_URL="https://sls-standalone-1300963013.cos.ap-shanghai.myqcloud.com/install.sh"
6+
export SLS_GEO_LOCATION=cn
7+
fi
8+
curl -o- -L "$SLS_SCRIPT_URL" | VERSION=$ORB_PARAM_SERVERLESS_VERSION bash
39
# shellcheck disable=SC2016
410
echo 'export PATH=$HOME/.serverless/bin:$PATH' >> "$BASH_ENV"
511
# shellcheck disable=SC1090

0 commit comments

Comments
 (0)