0203a65973
Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
978 B
JavaScript
39 lines
978 B
JavaScript
/**
|
|
* PM2 进程配置 — API 密钥管理工具
|
|
* 用法: pm2 start ecosystem.config.cjs
|
|
*/
|
|
const path = require("path");
|
|
|
|
const ROOT = __dirname;
|
|
const isWin = process.platform === "win32";
|
|
|
|
// 优先使用项目内 venv;若无 venv,改为 "python" 或系统 Python 绝对路径
|
|
const venvPython = isWin
|
|
? path.join(ROOT, "venv", "Scripts", "python.exe")
|
|
: path.join(ROOT, "venv", "bin", "python");
|
|
|
|
module.exports = {
|
|
apps: [
|
|
{
|
|
name: "api-key-manager",
|
|
script: "app.py",
|
|
cwd: ROOT,
|
|
interpreter: venvPython,
|
|
instances: 1,
|
|
exec_mode: "fork",
|
|
autorestart: true,
|
|
watch: false,
|
|
max_restarts: 10,
|
|
min_uptime: "5s",
|
|
max_memory_restart: "200M",
|
|
error_file: path.join(ROOT, "logs", "pm2-error.log"),
|
|
out_file: path.join(ROOT, "logs", "pm2-out.log"),
|
|
log_date_format: "YYYY-MM-DD HH:mm:ss",
|
|
merge_logs: true,
|
|
env: {
|
|
PYTHONUNBUFFERED: "1",
|
|
},
|
|
},
|
|
],
|
|
};
|