Spaces:
Paused
Paused
| // Detect the environment, defaulting to 'local' if NODE_ENV is not set | |
| var env = process.env.NODE_ENV === 'production' ? 'production' : 'local'; | |
| // Initialize config with default values | |
| var config = { | |
| addon: 'started', | |
| port: process.env.PORT || 3000 // Use PORT from environment or default to 3000 | |
| }; | |
| // Environment-specific configuration | |
| switch (env) { | |
| // Hugging Face server build (production) | |
| case 'production': | |
| config.local = `http://0.0.0.0:${config.port}`; // Required binding for Hugging Face deployment | |
| break; | |
| // Local server build (development) | |
| case 'local': | |
| config.local = `http://127.0.0.1:${config.port}`; // Localhost URL with port | |
| break; | |
| } | |
| module.exports = config; | |