fix: use default topic if none is given

This commit is contained in:
Bastien Riviere 2023-09-03 16:45:46 +02:00
parent ac2940ccfe
commit 64e91cb2d4
Signed by: babariviere
GPG key ID: 4E5F0839249F162E

View file

@ -77,8 +77,11 @@ func main() {
} }
slog.Debug("Registering bridge", "route", route, "handler", handler.Type) slog.Debug("Registering bridge", "route", route, "handler", handler.Type)
// TODO: use default topic if topic == "" topic := handler.Topic
bridge := bridge.NewBridge(cfg.Ntfy.Server, handler.Topic, h) if topic == "" {
topic = cfg.Ntfy.DefaultTopic
}
bridge := bridge.NewBridge(cfg.Ntfy.Server, topic, h)
if !auth.IsEmpty() { if !auth.IsEmpty() {
bridge.WithAuth(auth) bridge.WithAuth(auth)
} }