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