# 应用基础配置 app: name: "PigFarmController" # 应用名称 version: "1.0.0" # 应用版本 jwt_secret: "your_jwt_secret_key_here" # JWT 签名密钥,请务必修改为强密码 # 服务器配置 server: port: 8080 # 服务器监听端口 mode: "debug" # 运行模式: debug, release, test # 日志配置 log: level: "info" # 日志级别: debug, info, warn, error, dpanic, panic, fatal format: "console" # 日志输出格式: console, json enable_file: true # 是否同时输出到文件 file_path: "app_logs/pig_farm_controller.log" # 日志文件路径 max_size: 100 # 单个日志文件最大大小 (MB) max_backups: 7 # 最多保留的旧日志文件数量 max_age: 7 # 最多保留的旧日志文件天数 compress: true # 是否压缩旧日志文件 # 数据库配置 database: host: "localhost" # 数据库主机地址 port: 5432 # 数据库端口 username: "postgres" # 数据库用户名 password: "your_db_password" # 数据库密码 dbname: "pig_farm_controller_db" # 数据库名称 sslmode: "disable" # SSL模式: disable, require, verify-ca, verify-full is_timescaledb: false # 是否为 TimescaleDB max_open_conns: 100 # 最大开放连接数 max_idle_conns: 10 # 最大空闲连接数 conn_max_lifetime: 300 # 连接最大生命周期 (秒) # WebSocket配置 websocket: timeout: 60 # WebSocket请求超时时间 (秒) heartbeat_interval: 30 # 心跳检测间隔 (秒) # 心跳配置 heartbeat: interval: 10 # 心跳间隔 (秒) concurrency: 5 # 请求并发数 # ChirpStack API 配置 chirp_stack: api_host: "http://localhost:8080" # ChirpStack API 主机地址 api_token: "your_chirpstack_api_token" # ChirpStack API Token fport: 10 # ChirpStack FPort api_timeout: 10 # ChirpStack API请求超时时间(秒) # 等待设备上行响应的超时时间(秒)。 # 对于LoRaWAN这种延迟较高的网络,建议设置为5分钟 (300秒) 或更长。 collection_request_timeout: 300 # 任务调度配置 task: interval: 5 # 任务调度间隔 (秒) num_workers: 5 # 任务执行器并发工作数量 # Lora 配置 lora: mode: "lora_mesh" # Lora 运行模式: lora_wan, lora_mesh # Lora Mesh 配置 lora_mesh: # 主节点串口 uart_port: "COM7" # LoRa模块的通信波特率 baud_rate: 9600 # 等待LoRa模块AT指令响应的超时时间(ms) timeout: 50 # LoRa Mesh 模块发送模式(EC: 透传; ED: 完整数据包) # e.g. # EC: 接收端只会接收到消息, 不会接收到请求头 # e.g. 发送: EC 05 02 01 48 65 6c 6c 6f # (EC + 05(消息长度) + 0201(地址) + "Hello"(消息本体)) # 接收: 48 65 6c 6c 6f ("Hello") # ED: 接收端会接收完整数据包,包含自定义协议头和地址信息。 # e.g. 发送: ED 05 12 34 01 00 01 02 03 # (ED(帧头) + 05(Length, 即 1(总包数)+1(当前包序号)+3(数据块)) + 12 34(目标地址) + 01(总包数) + 00(当前包序号) + 01 02 03(数据块)) # 接收: ED 05 12 34 01 00 01 02 03 56 78(56 78 是发送方地址,会自动拼接到消息末尾) lora_mesh_mode: "ED" # 单包最大用户数据数据长度, 模块限制240, 去掉两位自定义包头, 还剩238 max_chunk_size: 238 #分片重组超时时间(秒)。如果在一个分片到达后,超过这个时间 # 还没收到完整的包,则认为接收失败。 reassembly_timeout: 30 # 通知服务配置 notify: primary: "日志" # 首选通知渠道: "邮件", "企业微信", "飞书", "日志" (如果其他渠道未启用,"日志" 会自动成为首选) failureThreshold: 2 # 连续失败多少次后触发广播模式 smtp: enabled: false # 是否启用 SMTP 邮件通知 host: "smtp.example.com" # SMTP 服务器地址 port: 587 # SMTP 服务器端口 username: "your_email@example.com" # 发件人邮箱地址 password: "your_email_password" # 发件人邮箱授权码或密码 sender: "PigFarm Alarm " # 发件人名称和地址 wechat: enabled: false # 是否启用企业微信通知 corpID: "wwxxxxxxxxxxxx" # 企业ID (CorpID) agentID: "1000001" # 应用ID (AgentID) secret: "your_wechat_app_secret" # 应用密钥 (Secret) lark: enabled: false # 是否启用飞书通知 appID: "cli_xxxxxxxxxx" # 应用 ID appSecret: "your_lark_app_secret" # 应用密钥 # 定时采集配置 collection: interval: 300 # 采集间隔 (秒)