Skip to content

Commit

Permalink
Merge pull request #197 from sarbash/fix-tls-consul-registry
Browse files Browse the repository at this point in the history
Check for uninitialized *config.HttpClient
  • Loading branch information
Asim Aslam authored Aug 15, 2017
2 parents 87c3954 + db0df07 commit e3f818d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions registry/consul_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func newConsulRegistry(opts ...Option) Registry {
config = c
}
}
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}

// set timeout
if options.Timeout > 0 {
Expand All @@ -81,9 +84,6 @@ func newConsulRegistry(opts ...Option) Registry {
if options.Secure || options.TLSConfig != nil {
config.Scheme = "https"
// We're going to support InsecureSkipVerify
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}
config.HttpClient.Transport = newTransport(options.TLSConfig)
}

Expand Down

0 comments on commit e3f818d

Please sign in to comment.