Spaces:
Running
Running
// Detect if we're running in a HF Space | |
const isHfSpace = | |
window.location.hostname.endsWith(".hf.space") || | |
window.location !== window.parent.location; | |
// Get the base API URL based on the environment | |
const API_BASE_URL = isHfSpace | |
? `${window.location.origin}` // En production (HF Space), on utilise l'URL racine | |
: "http://localhost:3002"; // En développement | |
export const API_URLS = { | |
leaderboards: `${API_BASE_URL}/api/leaderboards`, | |
health: `${API_BASE_URL}/api/health`, | |
}; | |
// Export additional environment info | |
export const ENV_INFO = { | |
isHfSpace, | |
}; | |
export default API_URLS; | |