Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Update go dependencies
Build with go 1.16
Fix typos and added docstrings
  • Loading branch information
jayme-github committed Mar 29, 2021
1 parent 36da0f3 commit 3c9e043
Show file tree
Hide file tree
Showing 6 changed files with 529 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
alertmanager-webhook-fcm
serviceAccountKey.json
build/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- docker
matrix:
include:
- go: 1.13.x
- go: 1.16.x
env:
- LATEST=true
- go: tip
Expand Down
8 changes: 5 additions & 3 deletions fcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func init() {
tmplBody = tmpltext.Must(tmpltext.New("body").Option("missingkey=zero").Parse(bodyTemplate))
}

// TemplateError is returned if there was an error rendering a template
type TemplateError struct {
Type string
Err error
Expand All @@ -61,6 +62,7 @@ func NewMessaging() (*messaging.Client, error) {
return client, err
}

// NewDataMessage returns a new FCM data message
func NewDataMessage(topic, title, body string) *messaging.Message {
unixMillisecondsUTC := time.Now().UTC().UnixNano() / 1000000
data := map[string]string{
Expand All @@ -78,8 +80,8 @@ func NewDataMessage(topic, title, body string) *messaging.Message {
}
}

// NewNoficationMessage returns a new FCM message including notificaton data
func NewNoficationMessage(topic, title, body string) *messaging.Message {
// NewNotificationMessage returns a new FCM message including notification data
func NewNotificationMessage(topic, title, body string) *messaging.Message {
message := NewDataMessage(topic, title, body)
message.Notification = &messaging.Notification{
Title: title,
Expand All @@ -89,7 +91,7 @@ func NewNoficationMessage(topic, title, body string) *messaging.Message {
return message
}

// NewMessageFromAlertmanagerDats returns a new FCM data message from alertmanager POST data
// NewMessageFromAlertmanagerData returns a new FCM data message from alertmanager POST data
func NewMessageFromAlertmanagerData(topic string, m *template.Data) (*messaging.Message, error) {
title, err := tmpltextExecuteToString(tmplTitle, m)
if err != nil {
Expand Down
19 changes: 14 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ module github.com/jayme-github/alertmanager-webhook-fcm
go 1.14

require (
cloud.google.com/go/firestore v1.2.0 // indirect
cloud.google.com/go v0.80.0 // indirect
cloud.google.com/go/firestore v1.5.0 // indirect
cloud.google.com/go/storage v1.14.0 // indirect
firebase.google.com/go v3.13.0+incompatible
github.com/golang/protobuf v1.5.2 // indirect
github.com/julienschmidt/httprouter v1.3.1-0.20200114094804-8c9f31f047a3
github.com/prometheus/alertmanager v0.20.0
github.com/prometheus/client_golang v1.6.0
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
google.golang.org/api v0.26.0 // indirect
github.com/prometheus/alertmanager v0.21.0
github.com/prometheus/client_golang v1.10.0
github.com/prometheus/common v0.20.0 // indirect
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20210329181859-df645c7b52b1
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 // indirect
golang.org/x/sys v0.0.0-20210326220804-49726bf1d181 // indirect
google.golang.org/api v0.43.0 // indirect
google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee // indirect
)
Loading

0 comments on commit 3c9e043

Please sign in to comment.