diff --git a/.gitignore b/.gitignore index 3b2e45c..2d49d97 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,8 @@ conf/conf.ini dist/ data/ -tmp/ \ No newline at end of file +tmp/ +.devcontainer/.env +.devcontainer/devcontainer.json +.devcontainer/docker-compose.yml +.devcontainer/Dockerfile diff --git a/application/dependency/dependency.go b/application/dependency/dependency.go index 300fb8a..70d8514 100644 --- a/application/dependency/dependency.go +++ b/application/dependency/dependency.go @@ -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()) diff --git a/pkg/cache/redis.go b/pkg/cache/redis.go index 12d5c32..d564768 100644 --- a/pkg/cache/redis.go +++ b/pkg/cache/redis.go @@ -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 { diff --git a/pkg/conf/conf.go b/pkg/conf/conf.go index 78e770b..372f68e 100644 --- a/pkg/conf/conf.go +++ b/pkg/conf/conf.go @@ -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 ( diff --git a/pkg/conf/types.go b/pkg/conf/types.go index 8f6833e..54b288b 100644 --- a/pkg/conf/types.go +++ b/pkg/conf/types.go @@ -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, }