From 537ffa2cbf3479517d1073b66ac8289c77e7c6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lia=20Barroso?= Date: Wed, 23 Aug 2023 13:23:02 +0100 Subject: [PATCH] add missing ttl in pushhover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hélia Barroso --- config/notifiers.go | 1 + docs/configuration.md | 3 +++ notify/pushover/pushover.go | 1 + 3 files changed, 5 insertions(+) diff --git a/config/notifiers.go b/config/notifiers.go index 0da9e27ba2..db86b1a2f1 100644 --- a/config/notifiers.go +++ b/config/notifiers.go @@ -694,6 +694,7 @@ type PushoverConfig struct { Priority string `yaml:"priority,omitempty" json:"priority,omitempty"` Retry duration `yaml:"retry,omitempty" json:"retry,omitempty"` Expire duration `yaml:"expire,omitempty" json:"expire,omitempty"` + TTL duration `yaml:"ttl,omitempty" json:"ttl,omitempty"` HTML bool `yaml:"html" json:"html,omitempty"` } diff --git a/docs/configuration.md b/docs/configuration.md index c81a26e17a..ad49a086e0 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -945,6 +945,9 @@ token_file: # acknowledges the notification. [ expire: | default = 1h ] +# Optional time to live (ttl) to use for notification, see https://pushover.net/api#ttl +[ ttl: ] + # The HTTP client's configuration. [ http_config: | default = global.http_config ] ``` diff --git a/notify/pushover/pushover.go b/notify/pushover/pushover.go index 9964270a5e..6a4540f2eb 100644 --- a/notify/pushover/pushover.go +++ b/notify/pushover/pushover.go @@ -147,6 +147,7 @@ func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error) parameters.Add("expire", fmt.Sprintf("%d", int64(time.Duration(n.conf.Expire).Seconds()))) parameters.Add("device", tmpl(n.conf.Device)) parameters.Add("sound", tmpl(n.conf.Sound)) + parameters.Add("ttl", fmt.Sprintf("%d", int64(time.Duration(n.conf.TTL).Seconds()))) if err != nil { return false, err }