File size: 740 Bytes
ea70b43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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;