feat: statistics: finish dev
This commit is contained in:
21
initialize/redis.go
Normal file
21
initialize/redis.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package initialize
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"nCovTrack-Backend/global"
|
||||
|
||||
"github.com/go-redis/redis"
|
||||
)
|
||||
|
||||
func initRedis() {
|
||||
rds := redis.NewClient(&redis.Options{
|
||||
Addr: fmt.Sprintf("%s:%d", global.ServerSettings.Redis.Host, global.ServerSettings.Redis.Port),
|
||||
Password: global.ServerSettings.Redis.Password,
|
||||
DB: 0,
|
||||
})
|
||||
_, err := rds.Ping().Result()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
global.Redis = rds
|
||||
}
|
||||
Reference in New Issue
Block a user