22 lines
413 B
Go
22 lines
413 B
Go
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
|
|
}
|