feat: 添加.env.local配置

This commit is contained in:
2025-11-07 15:03:00 +08:00
parent 3d1c4853ce
commit 0f1f775605
2 changed files with 7 additions and 10 deletions

View File

@@ -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 ║
╚════════════════════════════════════════════════════════╝
`);
});

View File

@@ -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':