/**
 * PM2：在项目根执行 `pm2 start ecosystem.config.cjs` 后 `pm2 save`
 * web 使用 scripts/launch.py：若缺少 web-console/out 会自动 npm build 再起 uvicorn
 */
const path = require("path");
const root = __dirname;
const py = process.env.PYTHON || "python3";

module.exports = {
  apps: [
    {
      name: "web",
      cwd: root,
      script: path.join(root, "scripts", "launch.py"),
      interpreter: py,
      env: {
        HOST: "0.0.0.0",
        PORT: process.env.PORT || "8001",
      },
    },
    // { name: "youtube", cwd: root, script: py, args: "youtube.py" },
    // { name: "tiktok", cwd: root, script: py, args: "tiktok.py" },
    // Linux: { name: "obs", cwd: root, script: "bash", args: `-lc ${JSON.stringify(path.join(root, "obs.sh"))}` },
    // Win:   { name: "obs", cwd: root, script: "cmd.exe", args: "/c obs.bat" },
  ],
};
