Files
honoka-chan/handler/global.go
T
YumeMichi 7f2cd4d7fe Initial commit
Signed-off-by: Yuan Si <do4suki@gmail.com>
2023-03-20 23:12:06 +08:00

29 lines
452 B
Go

package handler
import (
"context"
"honoka-chan/config"
"github.com/redis/go-redis/v9"
)
var (
nonce = 0
redisCli *redis.Client
redisCtx = context.Background()
)
func init() {
redisCli = redis.NewClient(&redis.Options{
Addr: config.Conf.Redis.Host + ":" + config.Conf.Redis.Port,
Password: config.Conf.Redis.Pass,
DB: config.Conf.Redis.Db,
})
_, err := redisCli.Ping(redisCtx).Result()
if err != nil {
panic(err)
}
}