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

This commit is contained in:
Frank John Begornia
2025-12-31 02:46:02 +08:00
parent 82ad68a4d2
commit 2067c72dc6
4 changed files with 33 additions and 27 deletions

View File

@@ -2,10 +2,18 @@ const fs = require('fs');
const path = require('path');
// SSL Configuration (optional - only needed if not using Traefik/reverse proxy)
const sslConfig = process.env.USE_SSL === 'true' ? {
key: fs.readFileSync(process.env.SSL_KEY_PATH || '/etc/httpd/ssl/crewsportswear_app.key', 'utf8'),
cert: fs.readFileSync(process.env.SSL_CERT_PATH || '/etc/httpd/ssl/certs/current_cert.crt', 'utf8')
} : null;
let sslConfig = null;
if (process.env.USE_SSL === 'true') {
try {
sslConfig = {
key: fs.readFileSync(process.env.SSL_KEY_PATH || '/etc/httpd/ssl/crewsportswear_app.key', 'utf8'),
cert: fs.readFileSync(process.env.SSL_CERT_PATH || '/etc/httpd/ssl/certs/current_cert.crt', 'utf8')
};
} catch (err) {
console.error('Failed to read SSL certificates:', err.message);
console.log('Falling back to HTTP mode');
}
}
// CORS Configuration
const allowedOrigins = [