module.exports = {
  apps: [{
    name: 'jiebanke-backend',
    script: './src/server.js',
    instances: 1,
    exec_mode: 'fork',
    // 环境变量
    env: {
      NODE_ENV: 'development',
      PORT: 3310,
      WATCH: false
    },
    env_production: {
      NODE_ENV: 'production',
      PORT: 3310,
      WATCH: false
    },
    env_test: {
      NODE_ENV: 'test',
      PORT: 3311,
      WATCH: false
    },
    // 日志配置
    log_file: './logs/combined.log',
    out_file: './logs/out.log',
    error_file: './logs/error.log',
    log_date_format: 'YYYY-MM-DD HH:mm:ss',
    // 性能配置
    max_memory_restart: '1G',
    kill_timeout: 3000,
    // 重启策略
    autorestart: true,
    max_restarts: 10,
    restart_delay: 4000,
    // 监控配置
    watch: false,
    ignore_watch: [
      'node_modules',
      'logs',
      '.git',
      'uploads'
    ]
  }]
};