Files
order_site/apps/backend/config/default.cjs
T
2026-04-08 16:30:42 +08:00

113 lines
3.0 KiB
JavaScript
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.
const path = require('node:path')
module.exports = {
server: {
// 后端监听端口。
port: 3000,
},
browser: {
// 自定义浏览器可执行文件路径。
// 留空时默认使用 Playwright 自带的 Chromium。
chromePath: '',
// 是否启用无头模式。
// true / false 表示强制指定,null 表示按环境自动判断。
headless: null,
// 是否自动打开 DevTools。
// true / false 表示强制指定,null 表示按环境自动判断。
devtools: null,
// 是否让浏览器在空闲时继续常驻后台。
// true / false 表示强制指定,null 表示按环境自动判断。
keepAlive: null,
// 服务启动后是否立即预热浏览器,减少第一次创建会话的冷启动。
// true / false 表示强制指定,null 表示按环境自动判断。
prewarm: null,
// Playwright slowMo,单位毫秒。
// 设为 null 时,开发环境默认 150,生产环境默认 0。
slowMoMs: null,
},
session: {
// 是否输出浏览器会话调试日志,并在接口里带出调试字段。
debug: false,
},
ocr: {
// 本地 OCR 子服务目录。
projectRoot: path.resolve(__dirname, '../subservices/ocr-worker'),
},
database: {
// SQLite 数据文件。
filePath: path.resolve(__dirname, '../data/order-site.db'),
},
orders: {
// 用户领取页基础链接,不带末尾 token。
claimBaseUrl: 'http://127.0.0.1:5173/#/claim',
// 领取 token 默认有效时长。
tokenTtlHours: 24,
// 平台商品标识到内部 SKU 的映射。
skuMappings: {},
},
admin: {
// 后台 session 签名密钥,留空表示禁用后台登录。
sessionSecret: '',
// 后台登录态默认有效时长。
sessionTtlHours: 12,
// 默认初始化账号。仅在数据库里不存在同名用户时创建。
defaultUsers: [],
},
platforms: {
agiso: {
// Agiso 开放平台应用密钥,用于 webhook 验签。
appSecret: '',
messaging: {
// 是否启用 Agiso 站内消息发送。
enabled: false,
// 发送消息接口。
sendMessageEndpoint: 'https://gw-api.agiso.com/aldsIdle/ImMsg/SendMsg',
// Header 中的 ApiVersion。
apiVersion: '1',
// 兼容保留字段,当前发送消息固定使用 Bearer 鉴权。
authMode: 'bearer',
// 开放平台应用标识。
appId: '',
// 开放平台 AccessToken。
accessToken: '',
// 若单独配置则优先于 platforms.agiso.appSecret。
appSecret: '',
// 发送给用户的默认消息模板。
messageTemplate: '您的订单 {platformOrderId} 已创建领取链接,请在 {expiredAt} 前完成领取:{claimUrl}',
},
},
},
redeem: {
// 兑换后的证明产物模式:
// full = 完整证明(最终图 + 北京时间 + HTML + result.json
// basic = 只保留最终截图和 result.json
// off = 完全不生成证明文件
proofMode: 'full',
},
}