- 新增 POST /camera/setOSD 接口,下发OSD叠加信息到录制客户端 - 将 Redis 在线状态维护从 setInfo 迁移到 ping 心跳机制 - WebSocket ping 处理中增加 Redis 在线状态刷新 - 移除 fetchTasks 中 pack_mode=1 的限制条件 - 更新 frp auth_token
93 lines
2.5 KiB
JavaScript
93 lines
2.5 KiB
JavaScript
/* eslint valid-jsdoc: "off" */
|
||
|
||
/**
|
||
* @param {Egg.EggAppInfo} appInfo app info
|
||
*/
|
||
module.exports = appInfo => {
|
||
/**
|
||
* built-in config
|
||
* @type {Egg.EggAppConfig}
|
||
**/
|
||
const config = exports = {};
|
||
|
||
// use for cookie sign key, should change to your own and keep security
|
||
config.keys = appInfo.name + '_1772789382448_6777';
|
||
|
||
// add your middleware config here
|
||
config.cluster = {
|
||
listen: {
|
||
port: 4050, // 使用其他端口避免冲突
|
||
hostname: '0.0.0.0',
|
||
},
|
||
};
|
||
// add your user config here
|
||
const userConfig = {
|
||
// myAppName: 'egg',
|
||
};
|
||
config.bodyParser = {
|
||
jsonLimit: '10mb', // 增大 JSON 体限制
|
||
formLimit: '10mb', // 增大表单限制
|
||
textLimit: '10mb', // 增大文本限制
|
||
enableTypes: ['json', 'form', 'text'],
|
||
extendTypes: {
|
||
json: ['application/json'],
|
||
},
|
||
};
|
||
config.mysql = {
|
||
clients: {
|
||
wms: {
|
||
host: '127.0.0.1',
|
||
port: '3306',
|
||
user: 'wms',
|
||
password: 'P6j3YTHTpirepYWz',
|
||
database: 'wms',
|
||
},
|
||
},
|
||
app: true,
|
||
agent: false,
|
||
};
|
||
|
||
config.security = {
|
||
csrf: {
|
||
enable: false,
|
||
},
|
||
};
|
||
config.redis = {
|
||
client: {
|
||
host: '127.0.0.1', // Redis服务器地址
|
||
port: 6379, // Redis端口
|
||
password: 'qwe2019@', // Redis密码(如果有)
|
||
db: 11, // 使用的数据库索引
|
||
retryStrategy: (times) => Math.min(times * 200, 5000), // 断线重连策略
|
||
maxRetriesPerRequest: 3,
|
||
reconnectOnError: (err) => err.message.includes('READONLY'),
|
||
},
|
||
};
|
||
config.websocket = {
|
||
// 使用 Redis 适配器
|
||
adapter: {
|
||
type: 'redis',
|
||
redis: config.redis.client, // 复用 Redis 配置
|
||
},
|
||
// 或者更简单的配置方式
|
||
redis: config.redis.client,
|
||
};
|
||
config.jwt = {
|
||
secret: 'E5#ex.g@,GfL_8?', // 请替换为自己的密钥
|
||
};
|
||
config.frp = {
|
||
server_addr: 'o.gztbyc.com', // frps 地址
|
||
server_port: 6005, // frps bindPort
|
||
auth_token: 'frpPrintToken2024', // frps auth.token
|
||
subdomain_host: 'o.gztbyc.com', // 子域名后缀
|
||
vhost_http_port: 18080, // frps HTTP 代理端口(内部)
|
||
local_port: 8080, // 客户端本地 web 服务端口
|
||
subdomain_prefix: 'w', // 子域名前缀
|
||
disconnect_timeout: 5000, // 等待其他电脑断开 frpc 的超时(ms)
|
||
};
|
||
return {
|
||
...config,
|
||
...userConfig,
|
||
};
|
||
};
|