// PM2 設定 — Futu 快訊 Bot (A25)
// 用法:
//   cd /root/a25news && pm2 start ecosystem.config.js
//   pm2 logs futu-flash
//   pm2 save
module.exports = {
  apps: [{
    name: "futu-flash",
    script: "futu_flash_bot.py",
    interpreter: "python3",
    cwd: __dirname,
    autorestart: true,
    max_restarts: 20,
    restart_delay: 10000,          // 10s，避免快速連環重啟
    max_memory_restart: "200M",
    watch: false,
    env: {
      // ★ 憑證不放這裡。由 ./.env 或 /root/.env 提供：
      //   TELEGRAM_BOT_TOKEN=...
      //   TELEGRAM_CHAT_ID=...
      FLASH_INTERVAL: "60",
      FLASH_PAGE_SIZE: "30",
      PYTHONUNBUFFERED: "1"
    },
    out_file: "./logs/out.log",
    error_file: "./logs/err.log",
    merge_logs: true,
    time: true
  }]
};
