Files
order_site/apps/backend/src/config/defaults.ts
T

144 lines
3.6 KiB
TypeScript
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.
import path from 'node:path'
import type { RuntimeConfig } from '../types/runtime-config.js'
export function createDefaultRuntimeConfig(projectRoot: string): RuntimeConfig {
return {
server: {
port: 3000,
// 默认信任一层反代(Caddy),req.ip 才能取到真实客户端地址;直连暴露端口时设为 false。
trustProxy: 1,
},
data: {
root: path.resolve(projectRoot, 'data'),
},
logging: {
level: 'info',
// 对接日志默认只保留 warn/error,避免 integration-*.log 被 info 刷爆
integrationLevel: 'warn',
retentionDays: 30,
maxFileSizeMb: 20,
maxFiles: 5,
},
retention: {
// 原始报文只保留追溯所需窗口,清理后保留订单/事件摘要。
rawPayloadDays: 180,
taskEventDays: 180,
webhookEventDays: 180,
auditLogDays: 365,
workOrderEventDays: 180,
// 已处理的成本异常保留 60 天,之后搬进 cost_exceptions_archive;open 行不归档。
costExceptionDays: 60,
},
database: {
url: 'postgres://postgres:postgres@127.0.0.1:5432/order_site',
ssl: false,
maxConnections: 8,
idleTimeoutMs: 30_000,
connectionTimeoutMs: 5_000,
statementTimeoutMs: 15_000,
slowQueryThresholdMs: 500,
},
storage: {
mode: 'minio',
endpoint: 'http://127.0.0.1:9000',
bucket: 'order-site',
accessKeyId: 'minioadmin',
secretAccessKey: 'minioadmin',
region: 'us-east-1',
maxUploadSizeMb: 10,
oss: {
endpoint: '',
bucket: '',
accessKeyId: '',
secretAccessKey: '',
region: 'oss-cn-hangzhou',
},
},
orders: {
claimBaseUrl: 'http://127.0.0.1:5173/h5',
// 0 表示长期有效;后台手动关闭任务后领取链接仍会立即失效。
tokenTtlHours: 0,
},
admin: {
sessionSecret: '',
// 后台:24h 空闲过期,登录后最多 7 天必须重新登录。
sessionIdleTtlHours: 24,
sessionAbsoluteTtlHours: 168,
defaultUsers: [],
},
platforms: {
ninetyone: {
userId: '',
secret: '',
version: '1.0',
shopId: '91kaquan',
shopName: '91卡券',
timestampToleranceSeconds: 600,
cardsEncoding: 'aes-256-ecb-base64',
},
kuaishouIndustry: {
appKey: '',
appSecret: '',
signSecret: '',
messageSecret: '',
provider: 'kuaishou-industry',
platform: 'kuaishou',
shopId: 'kuaishou-industry',
shopName: '快手行业电子凭证',
version: '1',
},
affiliateDash: {
enabled: true,
baseUrl: '',
appKey: '',
appSecret: '',
callbackSecret: '',
timeoutMs: 10000,
notifyUrl: '',
timestampToleranceSeconds: 300,
preferredMatchEnabled: true,
skuMapping: {},
},
},
cors: {
allowedOrigins: ['*'],
},
worker: {
sms: {
provider: 'mock',
accessKeyId: '',
accessKeySecret: '',
signName: '',
templateCode: '',
codeTtlSeconds: 300,
cooldownSeconds: 60,
dailyLimit: 10,
},
orderTimelineVisible: false,
// 打手:7 天空闲过期,登录后最多 30 天必须重新登录。
sessionIdleTtlHours: 168,
sessionAbsoluteTtlHours: 720,
acceptanceVideo: {
enabled: true,
maxDurationSeconds: 30,
maxSizeMb: 12,
targetHeight: 720,
bitrateKbps: 1200,
audioBitrateKbps: 64,
fps: 30,
},
},
}
}