feat: 初始化 Redis 连接
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
962142c4a5
commit
a1b42b9ccd
@ -11,6 +11,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/topfans/backend/gateway/config"
|
||||
"github.com/topfans/backend/gateway/router"
|
||||
"github.com/topfans/backend/pkg/database"
|
||||
"github.com/topfans/backend/pkg/logger"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -66,6 +67,19 @@ func main() {
|
||||
// 3. 设置 Gin 模式
|
||||
gin.SetMode(cfg.Server.Mode)
|
||||
|
||||
// 3.5 初始化 Redis
|
||||
logger.Logger.Info("Connecting to Redis...")
|
||||
if err := database.InitRedis(database.RedisConfig{
|
||||
Host: cfg.Redis.Host,
|
||||
Port: cfg.Redis.Port,
|
||||
Password: cfg.Redis.Password,
|
||||
DB: cfg.Redis.DB,
|
||||
}); err != nil {
|
||||
logger.Logger.Fatal("Failed to connect to Redis", zap.Error(err))
|
||||
}
|
||||
logger.Logger.Info("Redis connected successfully")
|
||||
defer database.CloseRedis()
|
||||
|
||||
// 4. 初始化 Dubbo Clients
|
||||
logger.Logger.Info("Connecting to Dubbo services...")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user