require('dotenv').config();

const config = {
  port: process.env.PORT || 4000,
  baseUrl: process.env.BASE_URL || `http://localhost:${process.env.PORT || 4000}`,
  uploadDir: process.env.UPLOAD_DIR || 'uploads',
  jwt: {
    secret: process.env.JWT_SECRET || 'changeme',
    expiresIn: process.env.JWT_EXPIRES_IN || '7d',
  },
  db: {
    host: process.env.DB_HOST || 'localhost',
    port: Number(process.env.DB_PORT || 3306),
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASSWORD || '',
    database: process.env.DB_NAME || 'attendance_db',
  },
  corsOrigins: (process.env.CORS_ORIGINS || '').split(',').filter(Boolean),
};

module.exports = config;
