fix(store/valkey): Redis™ Sentinel doesn't require a password

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso
2025-11-18 09:16:12 -05:00
parent 6ca74c65bd
commit 156502b3db
3 changed files with 3 additions and 8 deletions

View File

@@ -326,7 +326,7 @@ If you are using [Redis™ Sentinel](https://redis.io/docs/latest/operate/oss_an
| `clientName` | string | `Anubis` | The client name reported to Redis™ Sentinel. Set this if you want to track Anubis connections to your Redis™ Sentinel. |
| `masterName` | string | `mymaster` | (Required) The name of the master in the Redis™ Sentinel configuration. This is used to discover where to find client connection hosts/ports. |
| `username` | string | `azurediamond` | The username used to authenticate against the Redis™ Sentinel and Redis™ servers. |
| `password` | string | `hunter2` | (Required) The password used to authenticate against the Redis™ Sentinel and Redis™ servers. |
| `password` | string | `hunter2` | The password used to authenticate against the Redis™ Sentinel and Redis™ servers. |
## Risk calculation for downstream services

View File

@@ -24,7 +24,6 @@ var (
// Sentinel validation errors
ErrSentinelMasterNameRequired = errors.New("valkey.Sentinel: masterName is required")
ErrSentinelAddrRequired = errors.New("valkey.Sentinel: addr is required")
ErrSentinelPasswordRequired = errors.New("valkey.Sentinel: password is required")
ErrSentinelAddrEmpty = errors.New("valkey.Sentinel: addr cannot be empty")
)
@@ -68,7 +67,7 @@ type Sentinel struct {
Addr internal.ListOr[string] `json:"addr"`
ClientName string `json:"clientName,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password"`
Password string `json:"password,omitempty"`
}
func (s Sentinel) Valid() error {
@@ -94,10 +93,6 @@ func (s Sentinel) Valid() error {
}
}
if s.Password == "" {
errs = append(errs, ErrSentinelPasswordRequired)
}
if len(errs) > 0 {
return errors.Join(errs...)
}

View File

@@ -91,7 +91,7 @@ func TestFactoryValid(t *testing.T) {
{
name: "sentinel missing password",
jsonData: `{"sentinel": {"masterName": "mymaster", "addr": ["localhost:26379"]}}`,
expectError: ErrSentinelPasswordRequired,
expectError: nil,
},
{
name: "sentinel with optional fields",