Browse Source

feat: 添加.env.local配置

master
echo 1 month ago
parent
commit
0f1f775605
  1. 2
      scripts/proxy-server.js
  2. 9
      utils/config.ts

2
scripts/proxy-server.js

@ -101,7 +101,7 @@ 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)}

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

Loading…
Cancel
Save