Files
Leantime/.dev/remote-deploy/24_fix_env.sh

27 lines
836 B
Bash

#!/bin/bash
set -e
APP_DIR=/var/www/onebot
echo "=== 移动 .env 到 config/.env ==="
mv "$APP_DIR/.env" "$APP_DIR/config/.env" 2>/dev/null || cp "$APP_DIR/.env" "$APP_DIR/config/.env"
chown rui:www-data "$APP_DIR/config/.env"
chmod 664 "$APP_DIR/config/.env"
echo "=== 确认位置 ==="
ls -la "$APP_DIR/.env" 2>/dev/null && echo "根目录 .env 仍存在(需删除)" || echo "根目录 .env 已移除"
ls -la "$APP_DIR/config/.env" && echo "config/.env 已就位"
echo ""
echo "=== 清缓存 ==="
rm -rf "$APP_DIR/storage/framework/cache/"* 2>/dev/null
rm -f "$APP_DIR/bootstrap/cache/"*.php 2>/dev/null
echo "缓存已清"
echo ""
echo "=== 验证数据库连接配置 ==="
grep -E "LEAN_DB_|DB_" "$APP_DIR/config/.env"
echo ""
echo "=== HTTP 测试 ==="
curl -s -o /dev/null -w "HTTP=%{http_code}\n" http://127.0.0.1:8081/