require('dotenv').config();
const config = {
    // Server Configuration
    port: process.env.PORT || 83,
    nodeEnv: process.env.NODE_ENV || 'development',
    // Database Configuration
    database: {
        host: process.env.DB_HOST || 'localhost',
        port: process.env.DB_PORT || 3306,
        name: process.env.DB_NAME || 'cms_db',
        user: process.env.DB_USER || 'root',
        password: process.env.DB_PASSWORD || ''
    },
    // JWT Configuration
    jwt: {
        secret: process.env.JWT_SECRET || 'your_super_secret_jwt_key_here',
        expiresIn: process.env.JWT_EXPIRES_IN || '24h',
        refreshExpiresIn: process.env.JWT_REFRESH_EXPIRES_IN || '7d'
    },
    // Session Configuration
    session: {
        secret: process.env.SESSION_SECRET || 'your_session_secret_here',
        resave: false,
        saveUninitialized: false,
        cookie: {
            secure: process.env.NODE_ENV === 'production',
            httpOnly: true,
            maxAge: 24 * 60 * 60 * 1000 // 24 hours
        }
    },
    // Email Configuration
    email: {
        host: process.env.EMAIL_HOST || 'smtp.gmail.com',
        port: process.env.EMAIL_PORT || 587,
        user: process.env.EMAIL_USER || '',
        pass: process.env.EMAIL_PASS || ''
    },
    // File Upload Configuration
    upload: {
        maxFileSize: parseInt(process.env.MAX_FILE_SIZE) || 5242880, // 5MB
        uploadPath: process.env.UPLOAD_PATH || 'uploads/',
        allowedTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf']
    },
    // Public Images Base URL (optional, uses env if set; defaults to 123.200.2.156:83)
    publicImagesBaseUrl: process.env.PUBLIC_IMAGES_BASE_URL || 'http://123.200.2.156:83',
    // Rate Limiting
    rateLimit: {
        windowMs: parseInt(process.env.RATE_LIMIT_WINDOW_MS) || 15 * 60 * 1000, // 15 minutes
        maxRequests: parseInt(process.env.RATE_LIMIT_MAX_REQUESTS) || 2000, // Increased to 2000 requests per 15 minutes
        // Specific rate limits for different endpoints
        auth: {
            windowMs: 15 * 60 * 1000, // 15 minutes
            maxRequests: 20 // 20 login attempts per 15 minutes
        },
        contact: {
            windowMs: 1 * 60 * 1000, // 1 minute
            maxRequests: 50 // 50 contact operations per minute
        },
        general: {
            windowMs: 1 * 60 * 1000, // 1 minute
            maxRequests: 600 // increased general requests per minute to reduce 429
        }
    },
    // CORS Configuration
    cors: {
        origin: [
            'http://10.1.0.25:83',
            'http://10.1.0.25:84',
            'http://10.1.0.25:85',
            'http://123.200.2.156:83',
            'http://localhost:3000',
            'http://localhost:5173',
            'http://localhost:83',
            'http://localhost:84'
        ],
        credentials: true
    },
    // Security
    security: {
        bcryptRounds: 12,
        maxLoginAttempts: 5,
        lockoutTime: 15 * 60 * 1000 // 15 minutes
    }
};
module.exports = config;
//# sourceMappingURL=config.js.map