Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf77658

Browse filesBrowse files
authored
fallback to Node.Address (#21)
Service.Address may not always exist, in which case it is safe to fallback to Node.Address
1 parent 8a34ba6 commit cf77658
Copy full SHA for cf77658

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎consul.go

Copy file name to clipboardExpand all lines: consul.go
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,13 @@ func watchConsulService(ctx context.Context, s servicer, tgt target, out chan<-
7676

7777
ee := make([]string, 0, len(ss))
7878
for _, s := range ss {
79-
ee = append(ee, fmt.Sprintf("%s:%d", s.Service.Address, s.Service.Port))
79+
address := s.Service.Address
80+
if s.Service.Address == "" {
81+
address = s.Node.Address
82+
}
83+
ee = append(ee, fmt.Sprintf("%s:%d", address, s.Service.Port))
8084
}
85+
8186
if tgt.Limit != 0 && len(ee) > tgt.Limit {
8287
ee = ee[:tgt.Limit]
8388
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.