Files
opsx-licence/.env.example
T
Logan.LiandCursor bac72e6945 fix: 按评审报告止血支付漏洞并加固授权链路
废除浏览器回跳自助结算,通用 webhook 强制密钥鉴权,Waffo 支持验签与未知事件忽略;重构订单状态机/激活占座/SQLite WAL,并补备份、readyz、限流与前端导出/登录页安全修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 21:26:58 +08:00

102 lines
3.8 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# opsx-licence - 环境变量配置模板
# 复制此文件为 .env 并根据需要修改
# Docker: cp .env.example .env && ./run.sh docker up
# ============================================
# 后端配置 (backend)
# ============================================
# 服务器端口
PORT=9001
# 运行模式: debug / release(生产 / Docker 请用 release)
GIN_MODE=release
# JWT 密钥(生产环境必须修改!)
JWT_SECRET=your-super-secret-key-change-this-in-production
# 离线许可证签发 seed(32 字节 hex)。生产必须固定;轮换需同步桌面公钥。
# 生成示例: openssl rand -hex 32
# 当前生产公钥(桌面已嵌入): 108375d485c58a1a738f93c2cbb838f76331de981ee5da13d90a1f280672131d
# OFFLINE_LICENSE_SEED=
# 数据库配置
# 可选: sqlite / mysql / postgres
DB_DRIVER=sqlite
# 本地开发可用相对路径;Docker Compose 会覆盖为 /data/db.sqlite3
DB_NAME=db.sqlite3
# MySQL 配置(使用 mysql 时填写)
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_USER=root
# DB_PASSWORD=your-password
# DB_NAME=opsx_licence
# PostgreSQL 配置(使用 postgres 时填写)
# DB_HOST=127.0.0.1
# DB_PORT=5432
# DB_USER=postgres
# DB_PASSWORD=your-password
# DB_NAME=opsx_licence
# CORS 配置(多个用逗号分隔)
# CORS_ORIGINS=http://localhost:5181,http://127.0.0.1:5181
# ============================================
# Waffo 支付(OpsXShell 收银台 · pancake.waffo.ai)
# ============================================
# 店铺: https://pancake.waffo.ai/store/opsxshell-pwsi6m4n
# 包年一次性: PROD_1BIezCi932IbgCzRIV8hcJ (type=onetime, currency=CNY)
# 永久买断: PROD_0pcnzzT4nalEkkcdyIUoD5 (type=onetime, currency=CNY)
# 勿设置单一 WAFFO_CHECKOUT_URL,否则无法按档位分流商品
WAFFO_STORE_SLUG=opsxshell-pwsi6m4n
WAFFO_PRODUCT_ID=PROD_0pcnzzT4nalEkkcdyIUoD5
WAFFO_PRODUCT_ID_YEARLY=PROD_1BIezCi932IbgCzRIV8hcJ
WAFFO_PRODUCT_ID_PERPETUAL=PROD_0pcnzzT4nalEkkcdyIUoD5
WAFFO_CURRENCY=CNY
WAFFO_CURRENCY_YEARLY=CNY
WAFFO_CURRENCY_PERPETUAL=CNY
# test | live(test 时自动附加 test=true;API Key 会话由 Dashboard 环境决定)
WAFFO_ENVIRONMENT=test
# 支付成功回跳(桌面端 deep link;CreateOrder/Checkout 的 return_url 可覆盖)
SUCCESS_URL=https://l123.91ai.io/api/v1/purchase/success
# --- 官方打通必填(API Key 模式,见 https://docs.waffo.ai/zh/integrate/ai-integration)---
# Dashboard → Settings → API Keys:Merchant ID + RSA Private Key
# 有这两项时走 POST /v1/actions/checkout/create-session,并把本系统 ORD-* 写入 orderMerchantExternalId
# 没有则回退到 hosted store URL(无法可靠对账,仅调试用)
# WAFFO_MERCHANT_ID=mch_xxx
# 私钥 PEM(可用真实换行,或把换行写成 \n);勿提交仓库
# WAFFO_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----
# 或 Base64 整段 PEM:
# WAFFO_PRIVATE_KEY_BASE64=
# 兼容旧名:
# WAFFO_PRIVATE_KEY_PEM=
# Dashboard → Settings → Webhooks:
# URL: https://你的域名/api/v1/webhooks/waffo (尽量 HTTPS;Raw JSON;事件 order.completed)
# 当前公网: https://l123.91ai.io/api/v1/webhooks/waffo
# 验签公钥(RSA PEM)或共享密钥;配置后强制校验 X-Waffo-Signature
# WAFFO_WEBHOOK_PUBLIC_KEY=
# WAFFO_WEBHOOK_SECRET=
# 通用回调 /api/v1/webhooks/payment 在 release 下必须配置,并通过 X-Webhook-Secret 传入
# INTERNAL_WEBHOOK_SECRET=
# ============================================
# Docker Compose
# ============================================
# 宿主机映射端口(容器内固定 9001)
HOST_PORT=9001
VERSION=latest
# ============================================
# 前端配置 (frontend)
# ============================================
# 开发环境 API 地址
VITE_API_BASE_URL=http://localhost:9001/api
# 生产环境 API 地址(构建时注入)
# VITE_APP_BASE_API=/api