Skip to content

Commit

Permalink
Fix possible nil pointer panic (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashayakovtseva authored and Mstislav Bobakov committed Dec 18, 2019
1 parent 16e90da commit 3c338af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions target.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ func parseURL(u string) (target, error) {
return tgt, nil
}

// consulConfig based on the parsed target
// It use custom http-client
// consulConfig returns config based on the parsed target.
// It uses custom http-client.
func (t *target) consulConfig() *api.Config {
var creds *api.HttpBasicAuth
if len(t.User) > 0 && len(t.Password) > 0 {
creds = new(api.HttpBasicAuth)
creds.Password = t.Password
creds.Username = t.User
}
Expand Down

0 comments on commit 3c338af

Please sign in to comment.