Skip to content

Commit 7d18cca

Browse files
committed
other opts
1 parent a0959cb commit 7d18cca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rcache.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"io"
66
"net/url"
7+
"os"
78
"strconv"
89
"strings"
910
"time"
@@ -35,7 +36,10 @@ func New(redisURL string, logger logger) *Cache {
3536
// DB: 0, // use default DB
3637
}
3738

38-
if redisURL != "" {
39+
if redisURL == "" {
40+
opts.Host = os.Getenv("REDISHOST")
41+
opts.Port = os.Getenv("REDISPORT")
42+
} else {
3943
opts = &xredis.Options{}
4044
u, err := url.Parse(redisURL)
4145
if err != nil {

0 commit comments

Comments
 (0)