File size: 678 Bytes
3e44259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// API Configuration
// Use environment variable if available, otherwise default based on environment
const getApiUrl = () => {
  // Check for REACT_APP_API_URL environment variable
  if (process.env.REACT_APP_API_URL) {
    return process.env.REACT_APP_API_URL;
  }
  
  // For production builds (deployed on Vercel), use the backend URL from environment
  if (process.env.NODE_ENV === 'production') {
    // This should be set in Vercel environment variables
    return process.env.REACT_APP_API_URL || 'https://your-backend-url.com';
  }
  
  // Default for local development
  return 'http://localhost:7860';
};

export const API_URL = getApiUrl();

export default API_URL;