Skip to content

Commit

Permalink
fix(redis_config):修复redis配置问题
Browse files Browse the repository at this point in the history
  • Loading branch information
XiMo-210 committed Jan 25, 2024
1 parent 5d7cfd8 commit 5841c4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions config/redis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func getConfig() redisConfig {
if config.Config.IsSet("redis.db") {
Info.DB = config.Config.GetInt("redis.db")
}
if config.Config.IsSet("redis.password") {
Info.DB = config.Config.GetInt("redis.password")
if config.Config.IsSet("redis.pass") {
Info.Password = config.Config.GetString("redis.pass")
}
return Info
}
4 changes: 2 additions & 2 deletions config/session/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func getRedisConfig() redisConfig {
if config.Config.IsSet("redis.db") {
Info.DB = config.Config.GetInt("redis.db")
}
if config.Config.IsSet("redis.password") {
Info.DB = config.Config.GetInt("redis.password")
if config.Config.IsSet("redis.pass") {
Info.Password = config.Config.GetString("redis.pass")
}
return Info
}
2 changes: 1 addition & 1 deletion config/session/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ type redisConfig struct {

func setRedis(r *gin.Engine, name string) {
Info := getRedisConfig()
store, _ := sessionRedis.NewStore(10, "tcp", Info.Host+":"+Info.Port, "", []byte("secret"))
store, _ := sessionRedis.NewStore(10, "tcp", Info.Host+":"+Info.Port, Info.Password, []byte("secret"))
r.Use(sessions.Sessions(name, store))
}

0 comments on commit 5841c4d

Please sign in to comment.