Moved to REDIS_URL

This commit is contained in:
2024-04-08 23:50:49 -06:00
parent 057a4d9506
commit b1714d8ec5
4 changed files with 22 additions and 22 deletions

View File

@ -27,15 +27,16 @@ func NewRedisClient() *redis.Client {
}
godotenv.Load(".env")
redis_host := os.Getenv("REDIS_HOST")
redis_password := os.Getenv("REDIS_PASSWORD")
redis_url := os.Getenv("REDIS_URL")
lib.LogInfo.Printf("\n[PUBSUB/REDIS]Connecting to Redis at %s\n", redis_host)
RedisClient = redis.NewClient(&redis.Options{
Addr: redis_host,
Password: redis_password,
DB: 0,
})
opts, err := redis.ParseURL(redis_url)
if err != nil {
return nil
}
lib.LogInfo.Printf("\n[PUBSUB/REDIS]Connecting to Redis at %s\n", opts.Addr)
RedisClient = redis.NewClient(opts)
return RedisClient
}