Skip to content

Commit da7c143

Browse files
committed
fix host matching
1 parent d05208b commit da7c143

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

internals/discovery/discovery.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,20 @@ func getRouterHosts(container container.Summary) map[string][]string {
212212
return nil
213213
}
214214

215-
for key, value := range container.Labels {
216-
router := routerRegex.FindString(key)
217-
if router != "" {
218-
hosts[router] = hostRegex.FindStringSubmatch(value)
219-
}
220-
}
215+
for key, value := range container.Labels {
216+
routerMatch := routerRegex.FindStringSubmatch(key)
217+
if len(routerMatch) < 2 {
218+
continue
219+
}
220+
router := routerMatch[1]
221+
222+
matches := hostRegex.FindAllStringSubmatch(value, -1)
223+
for _, match := range matches {
224+
if len(match) >= 2 {
225+
hosts[router] = append(hosts[router], match[1])
226+
}
227+
}
228+
}
221229

222230
return hosts
223231
}

0 commit comments

Comments
 (0)