Skip to content

Commit

Permalink
feat: set download mirror location default to us (#33)
Browse files Browse the repository at this point in the history
* feat: add mirror parameter
  • Loading branch information
KyleTryon committed Apr 25, 2022
1 parent ffdc1a1 commit e9fe96f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/commands/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ parameters:
type: string
description: Specify the version of the Serverless Framework CLI to install. By default, the latest version will be used.
default: ""
mirror:
type: enum
enum:
- us
- cn
default: us
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.
steps:
- run:
name: Install Serverless CLI
environment:
ORB_PARAM_SERVERLESS_VERSION: <<parameters.version>>
ORB_PARAM_MIRROR: <<parameters.mirror>>
command: <<include(scripts/install.sh)>>
8 changes: 7 additions & 1 deletion src/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash
curl -o- -L https://slss.io/install | VERSION=$ORB_PARAM_SERVERLESS_VERSION bash
export SLS_SCRIPT_URL="https://sls-standalone-sv-1300963013.cos.na-siliconvalley.myqcloud.com/install.sh"
SLS_GEO_LOCATION=us
if [ "$ORB_PARAM_MIRROR" = "cn" ]; then
export SLS_SCRIPT_URL="https://sls-standalone-1300963013.cos.ap-shanghai.myqcloud.com/install.sh"
export SLS_GEO_LOCATION=cn
fi
curl -o- -L "$SLS_SCRIPT_URL" | VERSION=$ORB_PARAM_SERVERLESS_VERSION bash
# shellcheck disable=SC2016
echo 'export PATH=$HOME/.serverless/bin:$PATH' >> "$BASH_ENV"
# shellcheck disable=SC1090
Expand Down

0 comments on commit e9fe96f

Please sign in to comment.