Commit c0358261 authored by Nogweii's avatar Nogweii
Browse files

send a pushover notification

parent 2168f3cc
......@@ -36,9 +36,7 @@ func main() {
}
if anyGlobMatch {
log.WithFields(log.Fields{
"domains": allDomains,
}).Info("New certificate we're interested in found!")
notify(allDomains)
}
case err := <-errStream:
......
package main
import (
"fmt"
"github.com/gregdel/pushover"
log "github.com/sirupsen/logrus"
)
func notify(allDomains []string) {
log.WithFields(log.Fields{
"domains": allDomains,
}).Info("Sending a pushover notification")
// Create a new pushover app & user
app := pushover.New(configuration.PushoverAppToken)
recipient := pushover.NewRecipient(configuration.PushoverUserKey)
// Create the message to send
messageContents := fmt.Sprintf("New certificate issued for %v", allDomains)
message := pushover.NewMessage(messageContents)
// Send the message to the recipient
_, err := app.SendMessage(message, recipient)
if err != nil {
log.WithFields(log.Fields{"error": err}).Fatal("Could not send pushover message")
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment