M config.scfg => config.scfg +1 -1
@@ 65,7 65,7 @@ resolved {
ntfy {
# URL of the ntfy server.
- # Default: "https://ntfy.sh"
+ # Default: ""
server https://ntfy.sh
# Name of the ntfy topic. For backwards compatibility you can specify the full URL of the
# topic (e.g. https://ntfy.sh/alertmanager-alerts) and the server will be parsed from it.
M config/config.go => config/config.go +0 -2
@@ 430,8 430,6 @@ func Read(path string) (*Config, error) {
config.LogFormat = "text"
config.AlertMode = Multi
- config.Ntfy.Server = "https://ntfy.sh"
-
config.Cache.Type = "disabled"
config.Cache.Duration = time.Hour * 24
// memory
M config/config_test.go => config/config_test.go +1 -0
@@ 47,6 47,7 @@ resolved {
}
ntfy {
+ server https://ntfy.sh
topic https://ntfy.sh/alertmanager-alerts
certificate-fingerprint 13:6D:2B:88:9C:57:36:D0:81:B4:B2:9C:79:09:27:62:92:CF:B8:6A:6B:D3:AD:46:35:CB:70:17:EB:99:6E:28:08:2A:B8:C6:79:4B:F6:2E:81:79:41:98:1D:53:C8:07:B3:5C:24:5F:B1:8E:B6:FB:66:B5:DD:B4:D0:5C:29:91
user user
M main.go => main.go +4 -0
@@ 637,6 637,10 @@ func (br *bridge) topicURL(topic string) (string, error) {
return topic, nil
}
+ if br.cfg.Ntfy.Server == "" {
+ return "", errors.New("cannot set topic: no ntfy server set")
+ }
+
s, err := url.JoinPath(br.cfg.Ntfy.Server, topic)
if err != nil {
return "", err