From 07d66ac666eb650c9df15edbb99b1553e160d31f Mon Sep 17 00:00:00 2001 From: admin <362324317@qq.com> Date: Mon, 18 May 2026 06:14:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E9=A1=BA=E5=BA=8F(=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E7=A7=BB=E5=88=B0migrateCloudConfigs=E5=90=8E)=20+=20deploy.sh?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=A3=80=E6=B5=8BRedis=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source_clean/deploy.sh | 14 +++++++++++--- source_clean/src/database/database.ts | 15 ++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/source_clean/deploy.sh b/source_clean/deploy.sh index 6d31c4b..309c85b 100755 --- a/source_clean/deploy.sh +++ b/source_clean/deploy.sh @@ -22,17 +22,25 @@ if [ -n "$EXISTING_REDIS" ]; then docker network connect cloudsearch-net "$EXISTING_REDIS" 2>/dev/null || true echo " ✅ 已加入 cloudsearch-net" fi - REDIS_HOST="$EXISTING_REDIS" + + # 检测 Redis 密码 + REDIS_PASS=$(docker inspect "$EXISTING_REDIS" --format '{{range .Config.Cmd}}{{println .}}{{end}}' 2>/dev/null | grep -A1 'requirepass' | tail -1 || true) + if [ -n "$REDIS_PASS" ]; then + REDIS_URL="redis://:${REDIS_PASS}@${EXISTING_REDIS}:6379" + echo " 🔑 检测到 Redis 密码,已自动配置" + else + REDIS_URL="redis://${EXISTING_REDIS}:6379" + fi PROFILE="" else echo "📦 未检测到 Redis,将自动创建..." - REDIS_HOST="CloudSearch_Redis" + REDIS_URL="redis://CloudSearch_Redis:6379" PROFILE="--profile full" fi # 生成 .env cat > .env <