Debian Codegraph @

cmd/atomdns/handlers/dbhost/reload.go

raw
1 package dbhost
2
3 import (
4 "log/slog"
5 "path/filepath"
6
7 "codeberg.org/miekg/dns/cmd/atomdns/internal/dnszone"
8 )
9
10 // Reload launches a reload routine that listens for _write_ events to the hosts file.
11 func (d *Dbhost) Reload() error {
12 return dnszone.Watch(d.ctx, d.Path, func() {
13 alog := log().With(slog.String("path", filepath.Base(d.Path)))
14 if err := d.Load(); err != nil {
15 alog.Error("Failed to reload", Err(err))
16 return
17 }
18 alog.Info("Successful reload")
19 })
20 }