mirror of https://github.com/cloudreve/Cloudreve
feat(config): update Redis configuration to use TLS in configurre name instead of SSL
parent
72ec062cb0
commit
11c8a0fac3
|
@ -32,3 +32,7 @@ conf/conf.ini
|
|||
dist/
|
||||
data/
|
||||
tmp/
|
||||
.devcontainer/.env
|
||||
.devcontainer/devcontainer.json
|
||||
.devcontainer/docker-compose.yml
|
||||
.devcontainer/Dockerfile
|
||||
|
|
|
@ -329,11 +329,7 @@ func (d *dependency) KV() cache.Driver {
|
|||
d.kv = cache.NewRedisStore(
|
||||
d.Logger(),
|
||||
10,
|
||||
config.Network,
|
||||
config.Server,
|
||||
config.User,
|
||||
config.Password,
|
||||
config.DB,
|
||||
config,
|
||||
)
|
||||
} else {
|
||||
d.kv = cache.NewMemoStore(util.DataPath(cache.DefaultCacheFile), d.Logger())
|
||||
|
|
|
@ -3,11 +3,12 @@ package cache
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/conf"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/conf"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
||||
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
|
@ -45,8 +46,7 @@ func deserializer(value []byte) (any, error) {
|
|||
}
|
||||
|
||||
// NewRedisStore 创建新的redis存储
|
||||
func NewRedisStore(l logging.Logger, size int, configProvider conf.ConfigProvider) *RedisStore {
|
||||
redisConfig := configProvider.Redis()
|
||||
func NewRedisStore(l logging.Logger, size int, redisConfig *conf.Redis) *RedisStore {
|
||||
return &RedisStore{
|
||||
pool: &redis.Pool{
|
||||
MaxIdle: size,
|
||||
|
@ -67,7 +67,7 @@ func NewRedisStore(l logging.Logger, size int, configProvider conf.ConfigProvide
|
|||
redis.DialDatabase(db),
|
||||
redis.DialPassword(redisConfig.Password),
|
||||
redis.DialUsername(redisConfig.User),
|
||||
redis.DialUseTLS(redisConfig.UseSSL),
|
||||
redis.DialUseTLS(redisConfig.UseTLS),
|
||||
redis.DialTLSSkipVerify(redisConfig.TLSSkipVerify),
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
@ -2,12 +2,13 @@ package conf
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/logging"
|
||||
"github.com/cloudreve/Cloudreve/v4/pkg/util"
|
||||
"github.com/go-ini/ini"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -74,7 +74,7 @@ type Redis struct {
|
|||
User string
|
||||
Password string
|
||||
DB string
|
||||
UseSSL bool
|
||||
UseTLS bool
|
||||
TLSSkipVerify bool
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ var RedisConfig = &Redis{
|
|||
Server: "",
|
||||
Password: "",
|
||||
DB: "0",
|
||||
UseSSL: false,
|
||||
UseTLS: false,
|
||||
TLSSkipVerify: true,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue