Switched to REDIS_URL for ease of config
This commit is contained in:
parent
cf69a91cd0
commit
3f90abe196
2 changed files with 10 additions and 10 deletions
|
@ -5,8 +5,7 @@ SMTP_PORT=""
|
|||
SMTP_USERNAME=""
|
||||
SMTP_PASSWORD=""
|
||||
STRIPE_SECRET_KEY=""
|
||||
REDIS_HOST=""
|
||||
REDIS_PASSWORD=""
|
||||
REDIS_URL=""
|
||||
BUCKET_NAME=
|
||||
AWS_REGION=
|
||||
AWS_ENDPOINT_URL_S3=
|
||||
|
|
|
@ -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.ClientName)
|
||||
RedisClient = redis.NewClient(opts)
|
||||
|
||||
return RedisClient
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue