Skip to content

Commit

Permalink
solve NewRegistry httpclient 'nil pointer dereference' bug
Browse files Browse the repository at this point in the history
  • Loading branch information
printfcoder committed Feb 28, 2019
1 parent b8f2092 commit d3f447a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions registry/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ func configure(c *consulRegistry, opts ...registry.Option) {
}
}

if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}

// requires secure connection?
if c.opts.Secure || c.opts.TLSConfig != nil {
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}


config.Scheme = "https"
// We're going to support InsecureSkipVerify
config.HttpClient.Transport = newTransport(c.opts.TLSConfig)
Expand Down

0 comments on commit d3f447a

Please sign in to comment.