Files
nl-im-service/configs/config.yaml
2025-12-15 09:04:14 +08:00

80 lines
2.5 KiB
YAML
Raw Permalink 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.
# ==========================================
# 应用基础配置
# ==========================================
app:
name: "xk-websocket-v2"
# 服务监听端口 (HTTP & WebSocket)
port: "12080"
# 节点唯一标识符 (集群模式下必须唯一,用于路由消息)
node_id: "node-01"
# 日志级别: debug, info, warn, error
log_level: "debug"
# ==========================================
# MySQL 数据库配置
# ==========================================
database:
# 数据库连接字符串 (DSN)
# 格式: user:password@tcp(host:port)/dbname?charset=utf8mb4&parseTime=True&loc=Local
# dsn: "root:root@tcp(127.0.0.1:3306)/nl_im?charset=utf8mb4&parseTime=True&loc=Local"
dsn: "root:mysql_PKC65h@tcp(101.43.12.11:3306)/nl_im_plus?charset=utf8mb4&parseTime=True&loc=Local"
# 连接池最大空闲连接数
max_idle_conns: 10
# 连接池最大打开连接数
max_open_conns: 100
# ==========================================
# Redis 配置 (用于缓存和集群消息广播)
# ==========================================
redis:
addr: "101.43.12.11:6379"
password: "redis_xeePNa"
# 数据库索引 (0-15)
db: 0
# ==========================================
# JWT 配置
# ==========================================
jwt:
# JWT签名密钥生产环境应使用强随机密钥
secret: "xk-websocket-jwt-secret-key-2025-change-in-production"
# ==========================================
# TURN/STUN 服务器配置 (WebRTC 中继)
# ==========================================
turn:
# 是否启用内置 TURN 服务
enabled: true
# 服务器公网 IP (重要客户端必须能访问该IP)
public_ip: "101.43.12.11"
# TURN 服务监听端口 (UDP & TCP)
listen_port: 3478
# 认证领域名称
realm: "xk-chat"
# 共享密钥 (用于生成和校验临时凭证,分布式部署时所有节点必须一致)
shared_secret: "xk-super-secret-key-2025"
# UDP 端口范围下限
min_port: 49152
# UDP 端口范围上限
max_port: 65535
# ==========================================
# 媒体服务器配置 (WebRTC SFU + RTMP)
# ==========================================
media:
# 是否启用媒体服务器
enabled: true
# 服务器公网 IP (默认复用 turn.public_ip)
public_ip: ""
# WebRTC SFU 端口
webrtc_port: 8080
# RTMP 服务端口
rtmp_port: 1935
# HTTP-FLV 端口
http_flv_port: 7001
# 单房间最大人数
max_room_size: 9
# 视频编解码器 (h264)
video_codec: "h264"
# 音频编解码器 (opus)
audio_codec: "opus"