Remove .env file and enhance SSL error handling in server configuration
All checks were successful
Deploy Production (ss-tools.crewsportswear.app) / deploy (push) Successful in 1m15s
All checks were successful
Deploy Production (ss-tools.crewsportswear.app) / deploy (push) Successful in 1m15s
This commit is contained in:
21
server.js
21
server.js
@@ -68,11 +68,30 @@ const server = serverConfig.useSSL && sslConfig
|
||||
? https.createServer(sslConfig, app)
|
||||
: http.createServer(app);
|
||||
|
||||
// Handle server errors
|
||||
server.on('error', (err) => {
|
||||
if (err.code === 'EADDRINUSE') {
|
||||
console.error(`❌ Port ${serverConfig.port} is already in use`);
|
||||
console.error(' Please stop the other process or use a different port');
|
||||
} else if (err.code === 'ECONNREFUSED') {
|
||||
console.error(`❌ Connection refused on ${serverConfig.host}:${serverConfig.port}`);
|
||||
console.error(' Check if the port is accessible');
|
||||
} else {
|
||||
console.error('❌ Server error:', err);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
const protocol = serverConfig.useSSL && sslConfig ? 'https' : 'http';
|
||||
const sslNote = serverConfig.useSSL && sslConfig ? '(Direct SSL)' : '(SSL via Traefik/Reverse Proxy)';
|
||||
|
||||
// Start server
|
||||
server.listen(serverConfig.port, serverConfig.host, () => {
|
||||
server.listen(serverConfig.port, serverConfig.host, (err) => {
|
||||
if (err) {
|
||||
console.error('Failed to start server:', err);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('╔════════════════════════════════════════════════════════════╗');
|
||||
console.log('║ Screenshot Service - Unified Application Started ║');
|
||||
console.log('╚════════════════════════════════════════════════════════════╝');
|
||||
|
||||
Reference in New Issue
Block a user