fix: host filter accepts all and comma lists; hub no longer drops traefik lines after a copytruncate rotation

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Sonnet 5.5 committed 2026-11-16 20:27:18 -03:00
1 parent 19afd221e2
commit 7b90d9e40f
15 files changed
+329 -85

No files matched your search

+18 -1
View File
@@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"sort"
"strings"
"sync"
"time"
@@ -67,6 +68,22 @@ func NewHub(provider func() []Backend) *Hub {
subs: map[chan store.LiveEvent]struct{}{}, vsubs: map[chan store.VisitMsg]struct{}{}, attach: map[string]func(){}}
}
// onlyHas reports whether name is in only: one node name or a comma list.
func onlyHas(only, name string) bool {
if only == name {
return true
}
if !strings.Contains(only, ",") {
return false
}
for _, n := range strings.Split(only, ",") {
if strings.TrimSpace(n) == name {
return true
}
}
return false
}
func (h *Hub) backends(only string) []Backend {
if h == nil || h.Provider == nil {
return nil
@@ -74,7 +91,7 @@ func (h *Hub) backends(only string) []Backend {
all := h.Provider()
out := make([]Backend, 0, len(all))
for _, b := range all {
if only == "" || only == b.Name() {
if only == "" || onlyHas(only, b.Name()) {
out = append(out, b)
}
}