diff --git a/main/xiaozhi-server/start.sh b/main/xiaozhi-server/start.sh index 5eddb70ba..7217be289 100755 --- a/main/xiaozhi-server/start.sh +++ b/main/xiaozhi-server/start.sh @@ -169,20 +169,14 @@ init_env_file() { local ENV_FILE=".env" local public_ip="" - # For local region, skip public IP detection - if [ "$REGION" = "local" ] || [ "$REGION" = "LOCAL" ]; then - echo -e "${BLUE}→ Local region detected, using localhost${NC}" + echo -e "${BLUE}→ Detecting public IP...${NC}" + public_ip=$(get_public_ip) + + if [ -z "$public_ip" ]; then + echo -e "${YELLOW} Warning: Cannot detect public IP, using localhost${NC}" public_ip="localhost" else - echo -e "${BLUE}→ Detecting public IP for ${REGION_NAME}...${NC}" - public_ip=$(get_public_ip) - - if [ -z "$public_ip" ]; then - echo -e "${YELLOW} Warning: Cannot detect public IP, using localhost${NC}" - public_ip="localhost" - else - echo -e "${GREEN} Public IP: ${public_ip}${NC}" - fi + echo -e "${GREEN} Public IP: ${public_ip}${NC}" fi # Build URLs @@ -200,7 +194,7 @@ init_env_file() { # Append new config echo "" >> "$ENV_FILE" - echo "# Auto-generated by start.sh at $(date '+%Y-%m-%d %H:%M:%S') for region: ${REGION_NAME}" >> "$ENV_FILE" + echo "# Auto-generated by start.sh at $(date '+%Y-%m-%d %H:%M:%S')" >> "$ENV_FILE" echo "PUBLIC_IP=$public_ip" >> "$ENV_FILE" echo "WEBSOCKET_URL=$websocket_url" >> "$ENV_FILE" echo "OTA_URL=$ota_url" >> "$ENV_FILE"