fix(dev): 修复本地 MinIO 与 Go 依赖启动
This commit is contained in:
+15
-1
@@ -35,6 +35,9 @@ AUTO_KILL_PORTS="${DEV_AUTO_KILL_PORTS:-1}"
|
||||
FORCE_NPM_CI="${DEV_FORCE_NPM_CI:-0}"
|
||||
GOOSE_VERSION="${GOOSE_VERSION:-v3.27.1}"
|
||||
GOOSE_BIN="${GOOSE_BIN:-}"
|
||||
# 开发脚本与 Dockerfile 保持一致的 Go 模块代理,避免默认代理在本地网络不可达。
|
||||
GOPROXY="${DEV_GOPROXY:-${GOPROXY:-https://goproxy.cn,direct}}"
|
||||
export GOPROXY
|
||||
|
||||
BACKEND_PID=""
|
||||
FRONTEND_PID=""
|
||||
@@ -116,6 +119,8 @@ show_help() {
|
||||
前后端端口被占用时自动停止占用的 Docker 容器或本机进程
|
||||
DEV_FORCE_NPM_CI=0
|
||||
强制重新执行前端 npm ci
|
||||
DEV_GOPROXY=https://goproxy.cn,direct
|
||||
Go 模块代理,默认使用 goproxy.cn
|
||||
|
||||
示例:
|
||||
./scripts/dev.sh # 正常启动(后端 + 主前后台 + 分销前台)
|
||||
@@ -439,13 +444,22 @@ reset_database() {
|
||||
}
|
||||
|
||||
ensure_goose() {
|
||||
local gopath_goose
|
||||
|
||||
if [[ -z "${GOOSE_BIN}" ]]; then
|
||||
GOOSE_BIN="$(command -v goose || true)"
|
||||
fi
|
||||
|
||||
if [[ -z "${GOOSE_BIN}" ]]; then
|
||||
need_cmd go
|
||||
log "未找到 goose,正在安装 ${GOOSE_VERSION}..."
|
||||
gopath_goose="$(go env GOPATH)/bin/goose"
|
||||
if [[ -x "${gopath_goose}" ]]; then
|
||||
GOOSE_BIN="${gopath_goose}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${GOOSE_BIN}" ]]; then
|
||||
log "未找到 goose,正在使用 ${GOPROXY} 安装 ${GOOSE_VERSION}..."
|
||||
(cd "${ROOT_DIR}/backend" && go install "github.com/pressly/goose/v3/cmd/goose@${GOOSE_VERSION}")
|
||||
GOOSE_BIN="$(go env GOPATH)/bin/goose"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user