feat: authenticate the server's Redis connection
InitRedis now takes a username and password, read from REDIS_USERNAME and REDIS_PASSWORD, matching what admin has always done. Both empty keeps an unauthenticated Redis working; a password with an empty username is what a legacy requirepass instance needs, since go-redis then sends AUTH with one argument instead of two. This is what lets a Kubernetes install point at a managed Redis instead of the bundled one.
This commit is contained in:
+3
-1
@@ -91,7 +91,9 @@ func main() {
|
||||
services.StartAuditSweeper()
|
||||
|
||||
redisAddr := getEnv("REDIS_ADDR", "localhost:6379")
|
||||
if err := auth.InitRedis(redisAddr); err != nil {
|
||||
redisUser := os.Getenv("REDIS_USERNAME")
|
||||
redisPass := os.Getenv("REDIS_PASSWORD")
|
||||
if err := auth.InitRedis(redisAddr, redisUser, redisPass); err != nil {
|
||||
log.Fatalf("failed to connect to Redis: %v", err)
|
||||
}
|
||||
log.Println("connected to Redis")
|
||||
|
||||
Reference in New Issue
Block a user