diff --git a/scripts/proxy-server.js b/scripts/proxy-server.js index a24a853..3c0e0cd 100644 --- a/scripts/proxy-server.js +++ b/scripts/proxy-server.js @@ -101,11 +101,11 @@ app.get('/health', (req, res) => { app.listen(PORT, () => { console.log(` ╔════════════════════════════════════════════════════════╗ -║ 🚀 Proxy Server Running ║ +║ Proxy Server Running ║ ╠════════════════════════════════════════════════════════╣ -║ Local: http://localhost:${PORT} ║ -║ Target: ${API_TARGET.padEnd(40)} ║ -║ Health: http://localhost:${PORT}/health ║ +║ Local: http://localhost:${PORT} ║ +║ Target: ${API_TARGET.padEnd(40)} ║ +║ Health: http://localhost:${PORT}/health ║ ╚════════════════════════════════════════════════════════╝ `); }); diff --git a/utils/config.ts b/utils/config.ts index f087da0..e9ac4fd 100644 --- a/utils/config.ts +++ b/utils/config.ts @@ -51,12 +51,9 @@ export const getApiBaseUrl = (): string => { return 'http://localhost:8086/api'; } else { // iOS/Android 使用本机 IP - // ⚠️ 重要:需要替换为你的本机 IP 地址 - // 查看本机 IP: - // - Windows: ipconfig - // - Mac/Linux: ifconfig - // - 或者使用 Metro Bundler 显示的 IP - return 'http://192.168.1.100:8086/api'; + // 从环境变量读取,避免多人开发时地址冲突 + // 请在 .env.local 文件中配置 EXPO_PUBLIC_DEV_API_URL + return process.env.EXPO_PUBLIC_DEV_API_URL || 'http://192.168.1.100:8086/api'; } case 'staging':