Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions backends/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ const PUSHOVER_API_TOKEN = "abughxjjtuofgt89bz21mibut67j5t"
const PUSHOVER_API_URL = "https://api.pushover.net/1/messages.json"

type PushoverConfig struct {
UserKey string `mapstructure:"user_key" validate:"required"`
Device *string `mapstructure:"device" validate:"omitempty"`
Priority *string `mapstructure:"priority" validate:"omitempty,oneof=emergency high normal low lowest"`
Retry *int `mapstructure:"retry" validate:"omitempty,min=30"`
Expire *int `mapstructure:"expire" validate:"omitempty,min=0,max=10800"`
UserKey string `mapstructure:"user_key" validate:"required"`
ApplicationKey string `mapstructure:"application_key"`
Device *string `mapstructure:"device" validate:"omitempty"`
Priority *string `mapstructure:"priority" validate:"omitempty,oneof=emergency high normal low lowest"`
Retry *int `mapstructure:"retry" validate:"omitempty,min=30"`
Expire *int `mapstructure:"expire" validate:"omitempty,min=0,max=10800"`
}

type Pushover struct {
Expand All @@ -45,6 +46,9 @@ func (*Pushover) Send(configIface interface{}, title string, message string, sta
"title": title,
"message": message,
}
if config.ApplicationKey != "" {
body["token"] = *&config.ApplicationKey
}
if config.Device != nil {
body["device"] = *config.Device
}
Expand Down