mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-06-28 15:45:35 +08:00
Fix Bug: Can't Connect to Redis
This commit is contained in:
parent
138e687fbc
commit
593328627f
@ -8,6 +8,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -398,15 +399,15 @@ func RegisterCache() {
|
|||||||
var redisConfig struct {
|
var redisConfig struct {
|
||||||
Conn string `json:"conn"`
|
Conn string `json:"conn"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
DbNum int `json:"dbNum"`
|
DbNum string `json:"dbNum"`
|
||||||
}
|
}
|
||||||
redisConfig.DbNum = 0
|
redisConfig.DbNum = "0"
|
||||||
redisConfig.Conn = web.AppConfig.DefaultString("cache_redis_host", "")
|
redisConfig.Conn = web.AppConfig.DefaultString("cache_redis_host", "")
|
||||||
if pwd := web.AppConfig.DefaultString("cache_redis_password", ""); pwd != "" {
|
if pwd := web.AppConfig.DefaultString("cache_redis_password", ""); pwd != "" {
|
||||||
redisConfig.Password = pwd
|
redisConfig.Password = pwd
|
||||||
}
|
}
|
||||||
if dbNum := web.AppConfig.DefaultInt("cache_redis_db", 0); dbNum > 0 {
|
if dbNum := web.AppConfig.DefaultInt("cache_redis_db", 0); dbNum > 0 {
|
||||||
redisConfig.DbNum = dbNum
|
redisConfig.DbNum = strconv.Itoa(dbNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
bc, err := json.Marshal(&redisConfig)
|
bc, err := json.Marshal(&redisConfig)
|
||||||
|
Loading…
Reference in New Issue
Block a user