feat: main.go 接入配置 + graceful shutdown + logger 迁移

- main.go: 接入 config.Load() 替换硬编码 :8080
- main.go: 添加 signal.NotifyContext + http.Server.Shutdown(10s drain)
- main.go: 初始化 Zap 日志,prod 环境切换 Gin release 模式
- ws/handler.go: 所有 log.Printf 替换为 logger.Log 结构化日志
- 修复 .gitignore 排除规则(/server 仅匹配根目录二进制)
- 新增 zap、viper 依赖
This commit is contained in:
hhs
2026-06-13 15:18:03 +08:00
parent c523f53724
commit da87ec776b
5 changed files with 148 additions and 36 deletions

17
backend/.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
# 编译产物
/server
bin/
# 环境配置
.env
config.dev.yaml
config.prod.yaml
# 临时文件
tmp/
# IDE
.idea/
.vscode/
*.swp
*.swo