mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
fix:修改公网ip获取
This commit is contained in:
parent
7876925ec8
commit
dd24d445c1
1 changed files with 7 additions and 13 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue