watchdog: migrate to Cobra and Viper for config management; search /etc for configs

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I65dbf466cb030dccc7025585d6282bd26a6a6964
This commit is contained in:
raf 2026-03-01 18:09:34 +03:00
commit f988174145
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
9 changed files with 187 additions and 61 deletions

View file

@ -15,7 +15,7 @@ var prometheusLabelPattern = regexp.MustCompile(`^[a-zA-Z0-9_/:.-]*$`)
type MetricsAggregator struct {
pathRegistry *PathRegistry
eventRegistry *CustomEventRegistry
cfg config.Config
cfg *config.Config
pageviews *prometheus.CounterVec
customEvents *prometheus.CounterVec
pathOverflow prometheus.Counter
@ -30,7 +30,7 @@ type MetricsAggregator struct {
func NewMetricsAggregator(
pathRegistry *PathRegistry,
eventRegistry *CustomEventRegistry,
cfg config.Config,
cfg *config.Config,
) *MetricsAggregator {
// Build label names based on what's enabled in config
labels := []string{"path"} // path is always included