Files
crm-server/src/index.js
richardtekula 73a3c6bf95 hotfix: Security, performance, and code cleanup
- Remove hardcoded database password fallback
- Add encryption salt validation (min 32 chars)
- Separate EMAIL_ENCRYPTION_KEY from JWT_SECRET
- Fix command injection in status.service.js (use execFileSync)
- Remove unnecessary SQL injection regex middleware
- Create shared utilities (queryBuilder, pagination, emailAccountHelper)
- Fix N+1 query problems in contact and todo services
- Merge duplicate JMAP config functions
- Add database indexes migration
- Standardize error responses with error codes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 07:17:23 +01:00

27 lines
697 B
JavaScript

import './config/env.js';
import app from './app.js';
import { startAllCronJobs } from './cron/index.js';
import { logger } from './utils/logger.js';
import { testConnection } from './config/database.js';
const port = process.env.PORT || 5000;
const start = async () => {
try {
// Test database connection
await testConnection();
logger.success('Database connected');
// Start server - listen on all interfaces for network access
app.listen(port, '0.0.0.0', () => {
logger.info(`Server running on http://0.0.0.0:${port}`);
startAllCronJobs();
});
} catch (error) {
logger.error('Failed to start server', error);
process.exit(1);
}
};
start();