Skip to content

Commit

Permalink
Merge pull request #192 from jacobweinstock/hotfix-NewClient
Browse files Browse the repository at this point in the history
Fix nil values in provider registration:
  • Loading branch information
jacobweinstock authored Jan 25, 2021
2 parents b1c144f + dd43668 commit 6accef1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func NewClient(host, port, user, pass string, opts ...Option) *Client {
Registry: registrar.NewRegistry(),
}
defaultClient.Registry.Logger = defaultClient.Logger
defaultClient.registerProviders()

for _, opt := range opts {
opt(defaultClient)
Expand All @@ -57,6 +56,10 @@ func NewClient(host, port, user, pass string, opts ...Option) *Client {
defaultClient.Auth.Port = port
defaultClient.Auth.User = user
defaultClient.Auth.Pass = pass
// len of 0 means that no Registry, with any registered providers was passed in.
if len(defaultClient.Registry.Drivers) == 0 {
defaultClient.registerProviders()
}

return defaultClient
}
Expand Down

0 comments on commit 6accef1

Please sign in to comment.