diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 20b852e4..34cf019e 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -11,6 +11,13 @@ cp -fv $nginx_conf /etc/nginx/nginx.conf cp -fv $nginx_app_conf /etc/nginx/conf.d/front.conf sed -i "s,QL_BASE_URL,${qlBaseUrl},g" /etc/nginx/conf.d/front.conf pm2 l &>/dev/null + +if [[ $PipMirror ]]; then + pip3 config set global.index-url $PipMirror +fi +if [[ $NpmMirror ]]; then + npm config set registry $NpmMirror +fi echo echo -e "======================2. 安装依赖========================\n" diff --git a/sample/config.sample.sh b/sample/config.sample.sh index 066a22e5..83551386 100644 --- a/sample/config.sample.sh +++ b/sample/config.sample.sh @@ -46,9 +46,12 @@ AutoStartBot="" ## 是否使用第三方bot,默认不使用,使用时填入仓库地址,存到ql/repo目录下,文件夹命名为diybot BotRepoUrl="" -## 安装bot依赖时指定pip源,默认使用清华源,如不需要源,设置此参数为空 +## 安装python依赖时指定pip源,默认使用清华源 PipMirror="https://pypi.doubanio.com/simple/" +## 安装node依赖时指定pip源,默认使用清华源 +NpmMirror="https://registry.npmmirror.com" + ## 通知环境变量 ## 1. Server酱 ## https://sct.ftqq.com diff --git a/shell/share.sh b/shell/share.sh index d29f4cc8..73a37590 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -245,15 +245,13 @@ fix_config() { } npm_install_sub() { - set_proxy if [ $is_termux -eq 1 ]; then - npm install --production --no-bin-links --registry=https://registry.npmmirror.com || npm install --production --no-bin-links + npm install --production --no-bin-links elif ! type pnpm &>/dev/null; then - npm install --production --registry=https://registry.npmmirror.com || npm install --production + npm install --production else - pnpm install --loglevel error --production --registry=https://registry.npmmirror.com || pnpm install --production --loglevel error + pnpm install --loglevel error --production fi - unset_proxy } npm_install_1() { diff --git a/shell/update.sh b/shell/update.sh index bfe43a23..5cb39d1f 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -338,6 +338,13 @@ patch_version() { echo fi + if [[ $PipMirror ]]; then + pip3 config set global.index-url $PipMirror + fi + if [[ $NpmMirror ]]; then + npm config set registry $NpmMirror + fi + } ## 对比脚本