mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-13 03:58:45 +00:00
fix(store/valkey): Redis™ Sentinel doesn't require a password
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
@@ -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...)
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user