mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remote_cache: Fix redis connstr parsing (#18204)
* Fix redis connstr parsing * Don’t log the password
This commit is contained in:
parent
d16fd58bdb
commit
31547597d3
@ -22,8 +22,12 @@ func parseRedisConnStr(connStr string) (*redis.Options, error) {
|
||||
keyValueCSV := strings.Split(connStr, ",")
|
||||
options := &redis.Options{Network: "tcp"}
|
||||
for _, rawKeyValue := range keyValueCSV {
|
||||
keyValueTuple := strings.Split(rawKeyValue, "=")
|
||||
keyValueTuple := strings.SplitN(rawKeyValue, "=", 2)
|
||||
if len(keyValueTuple) != 2 {
|
||||
if strings.HasPrefix(rawKeyValue, "password") {
|
||||
// don't log the password
|
||||
rawKeyValue = "password******"
|
||||
}
|
||||
return nil, fmt.Errorf("incorrect redis connection string format detected for '%v', format is key=value,key=value", rawKeyValue)
|
||||
}
|
||||
connKey := keyValueTuple[0]
|
||||
|
Loading…
Reference in New Issue
Block a user