Skip to content

Commit 8ac83ed

Browse files
authored
Added CLI flag -u for Redis Auth username (#33)
1 parent b083aa9 commit 8ac83ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

redis-bechmark-go.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func main() {
162162
port := flag.Int("p", 12000, "Server port.")
163163
rps := flag.Int64("rps", 0, "Max rps. If 0 no limit is applied and the DB is stressed up to maximum.")
164164
rpsburst := flag.Int64("rps-burst", 0, "Max rps burst. If 0 the allowed burst will be the ammount of clients.")
165+
username := flag.String("u", "", "Username for Redis Auth.")
165166
password := flag.String("a", "", "Password for Redis Auth.")
166167
seed := flag.Int64("random-seed", 12345, "random seed to be used.")
167168
clients := flag.Uint64("c", 50, "number of clients.")
@@ -251,6 +252,9 @@ func main() {
251252
if *password != "" {
252253
opts.AuthPass = *password
253254
}
255+
if *username != "" {
256+
opts.AuthUser = *username
257+
}
254258
alwaysRESP2 := false
255259
if *resp == "2" {
256260
opts.Protocol = "2"
@@ -308,6 +312,7 @@ func main() {
308312
if *cscEnabled || *useRuedis {
309313
clientOptions := rueidis.ClientOption{
310314
InitAddress: []string{connectionStr},
315+
Username: *username,
311316
Password: *password,
312317
AlwaysPipelining: false,
313318
AlwaysRESP2: alwaysRESP2,

0 commit comments

Comments
 (0)