Skip to content

Commit

Permalink
Merge pull request #5 from avoykov/master
Browse files Browse the repository at this point in the history
#fix-initialisation
  • Loading branch information
snovichkov authored Jun 2, 2021
2 parents a92fd8a + 561ef5a commit 98cada2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"host": "127.0.0.1",
"port": "6379",
"db": 0,
"username": "someuser",
"password": "somepassword",
"max_retiries": 2,
"read_timeout": "2s",
Expand All @@ -22,5 +23,7 @@
}
}
```

"username" field is optional and ignored if empty
"password" field is optional and ignored if empty
"db" field is optional. Default is 0
"db" field is optional. Default is 0
1 change: 1 addition & 0 deletions goredis.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (b *Bundle) Build(builder *di.Builder) error {
Host: cfg.GetString(suffix + "host"),
Port: cfg.GetString(suffix + "port"),
DB: cfg.GetInt(suffix + "db"),
Username: cfg.GetString(suffix + "username"),
Password: cfg.GetString(suffix + "password"),
MaxRetries: cfg.GetInt(suffix + "max_retries"),
IdleTimeout: cfg.GetDuration(suffix + "idle_timeout"),
Expand Down
3 changes: 3 additions & 0 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type (
Host string `json:"host"`
Port string `json:"port"`
DB int `json:"db"`
Username string `json:"username"`
Password string `json:"password"`
MaxRetries int `json:"max_retries"`
IdleTimeout time.Duration `json:"idle_timeout"`
Expand Down Expand Up @@ -100,6 +101,8 @@ func (r *Registry) ConnectionWithName(name string) (_ *redis.Client, err error)
IdleTimeout: cfg.IdleTimeout,
ReadTimeout: cfg.ReadTimeout,
WriteTimeout: cfg.WriteTimeout,
Username: cfg.Username,
Password: cfg.Password,
}

if client = redis.NewClient(options); client == nil {
Expand Down

0 comments on commit 98cada2

Please sign in to comment.