Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	Update config.js
Browse files
    	
        config.js
    CHANGED
    
    | @@ -1,21 +1,23 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
            }
         | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
|  | |
|  | 
|  | |
| 1 | 
            +
            // Detect the environment, defaulting to 'local' if NODE_ENV is not set
         | 
| 2 | 
            +
            var env = process.env.NODE_ENV === 'production' ? 'production' : 'local';
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            // Initialize config with default values
         | 
| 5 | 
            +
            var config = {
         | 
| 6 | 
            +
                addon: 'started',
         | 
| 7 | 
            +
                port: process.env.PORT || 3000 // Use PORT from environment or default to 3000
         | 
| 8 | 
            +
            };
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            // Environment-specific configuration
         | 
| 11 | 
            +
            switch (env) {
         | 
| 12 | 
            +
                // Hugging Face server build (production)
         | 
| 13 | 
            +
                case 'production':
         | 
| 14 | 
            +
                    config.local = `http://0.0.0.0:${config.port}`; // Required binding for Hugging Face deployment
         | 
| 15 | 
            +
                    break;
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                // Local server build (development)
         | 
| 18 | 
            +
                case 'local':
         | 
| 19 | 
            +
                    config.local = `http://127.0.0.1:${config.port}`; // Localhost URL with port
         | 
| 20 | 
            +
                    break;
         | 
| 21 | 
            +
            }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            module.exports = config;
         |