Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support external redis host and using 127.0.0.1 as default #196

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion platform/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@ func envRedisPort() string {
return os.Getenv("REDIS_PORT")
}

func envRedisAddress() string {
return os.Getenv("REDIS_ADDRESS")
winlinvip marked this conversation as resolved.
Show resolved Hide resolved
}

func envRtmpPort() string {
return os.Getenv("RTMP_PORT")
}
Expand Down Expand Up @@ -481,7 +485,11 @@ var rdb *redis.Client

// InitRdb create and init global rdb, which is a redis client.
func InitRdb() error {
addr := "127.0.0.1"
addr := envRedisAddress()
if addr == "" {
addr = "127.0.0.1"
winlinvip marked this conversation as resolved.
Show resolved Hide resolved
}

rdb = redis.NewClient(&redis.Options{
Addr: fmt.Sprintf("%v:%v", addr, envRedisPort()),
Password: envRedisPassword(),
Expand Down