Add: Unix Socket support (#466)

* Update conf.go

* Update driver.go

* Update session.go

* Update defaults.go

* Update main.go

* Update conf.go

* Update defaults.go
This commit is contained in:
GuerraMorgan
2020-08-12 20:31:28 +08:00
committed by GitHub
parent dd50ef1c25
commit bfd2340732
5 changed files with 23 additions and 2 deletions

2
pkg/cache/driver.go vendored
View File

@@ -15,7 +15,7 @@ func Init() {
if conf.RedisConfig.Server != "" && gin.Mode() != gin.TestMode {
Store = NewRedisStore(
10,
"tcp",
conf.RedisConfig.Network,
conf.RedisConfig.Server,
conf.RedisConfig.Password,
conf.RedisConfig.DB,

View File

@@ -33,6 +33,10 @@ type ssl struct {
Listen string `validate:"required"`
}
type unix struct {
Listen string
}
// slave 作为slave存储端配置
type slave struct {
Secret string `validate:"omitempty,gte=64"`
@@ -57,6 +61,7 @@ type captcha struct {
// redis 配置
type redis struct {
Network string
Server string
Password string
DB string
@@ -120,6 +125,7 @@ func Init(path string) {
"Database": DatabaseConfig,
"System": SystemConfig,
"SSL": SSLConfig,
"Unix": UnixConfig,
"Captcha": CaptchaConfig,
"Redis": RedisConfig,
"Thumbnail": ThumbConfig,

View File

@@ -4,6 +4,7 @@ import "github.com/mojocn/base64Captcha"
// RedisConfig Redis服务器配置
var RedisConfig = &redis{
Network: "tcp",
Server: "",
Password: "",
DB: "0",
@@ -65,3 +66,7 @@ var SSLConfig = &ssl{
CertPath: "",
KeyPath: "",
}
var UnixConfig = &unix{
Listen: "",
}