mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-27 02:52:14 +01:00
28 lines
435 B
Go
28 lines
435 B
Go
package database
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/ansible-semaphore/semaphore/util"
|
|
"gopkg.in/redis.v3"
|
|
)
|
|
|
|
// Redis pool
|
|
var Redis *redis.Client
|
|
|
|
func init() {
|
|
Redis = redis.NewClient(&redis.Options{
|
|
MaxRetries: 2,
|
|
DialTimeout: 10 * time.Second,
|
|
Addr: util.Config.SessionDb,
|
|
})
|
|
}
|
|
|
|
func RedisPing() {
|
|
if _, err := Redis.Ping().Result(); err != nil {
|
|
fmt.Println("PING to redis unsuccessful")
|
|
panic(err)
|
|
}
|
|
}
|