Initial commit: crypto_key API key manager with PM2 and Ubuntu deploy docs

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-05-19 00:54:27 +08:00
commit 0203a65973
14 changed files with 1140 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
/**
* 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",
},
},
],
};