const fs = require('fs'); const path = require('path'); // SSL Configuration (optional - only needed if not using Traefik/reverse proxy) 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 - Whitelisted domains that can access the API const allowedOrigins = [ 'https://crewsportswear.com', 'https://www.crewsportswear.com', 'https://crewsportswear.app', 'https://dev-crew.crewsportswear.app', 'https://merchbay.com', 'https://www.merchbay.com', 'https://dev.merchbay.app', 'http://localhost', 'http://localhost:8080' ]; // Screenshot Configuration const screenshotConfig = { outputDir: process.env.OUTPUT_DIR || '/var/www/html/images/', baseUrl: process.env.BASE_URL || 'https://crewsportswear.app:5955/', viewportWidth: parseInt(process.env.VIEWPORT_WIDTH || '1366'), viewportHeight: parseInt(process.env.VIEWPORT_HEIGHT || '1100'), waitTime: parseInt(process.env.WAIT_TIME || '10000'), // milliseconds puppeteerArgs: ['--no-sandbox', '--disable-setuid-sandbox'] }; // Server Configuration const serverConfig = { port: process.env.PORT || 5955, host: process.env.HOST || '0.0.0.0', useSSL: process.env.USE_SSL === 'true' }; // Design viewer URLs const viewerUrls = { crewsportswear: 'https://crewsportswear.com/designer/viewer/', merchbay: 'https://crewsportswear.com/designer/merchbay-viewer/', merchbayLegacy: 'https://crewsportswear.com/designer/merchbay-viewer.php?id=' }; module.exports = { sslConfig, allowedOrigins, screenshotConfig, serverConfig, viewerUrls };