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_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=
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue