Template
1
0
Fork 0

Switched to REDIS_URL for ease of config

This commit is contained in:
Atridad Lahiji 2024-04-08 23:19:24 -06:00
parent cf69a91cd0
commit 3f90abe196
No known key found for this signature in database
2 changed files with 10 additions and 10 deletions

View file

@ -5,8 +5,7 @@ SMTP_PORT=""
SMTP_USERNAME="" SMTP_USERNAME=""
SMTP_PASSWORD="" SMTP_PASSWORD=""
STRIPE_SECRET_KEY="" STRIPE_SECRET_KEY=""
REDIS_HOST="" REDIS_URL=""
REDIS_PASSWORD=""
BUCKET_NAME= BUCKET_NAME=
AWS_REGION= AWS_REGION=
AWS_ENDPOINT_URL_S3= AWS_ENDPOINT_URL_S3=

View file

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