Skip to content

Commit

Permalink
setting a global FCM endpoint if the flag or env.var. is set (useful …
Browse files Browse the repository at this point in the history
…for tests)
  • Loading branch information
Cosmin Rentea committed Dec 21, 2016
1 parent 6b38303 commit 41fe815
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/gubled.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"strconv"
"syscall"

"github.com/Bogh/gcm"
"github.com/pkg/profile"
"github.com/smancke/guble/protocol"
"github.com/smancke/guble/server/apns"
Expand Down Expand Up @@ -132,8 +133,11 @@ var CreateModules = func(router router.Router) []interface{} {
logger.Panic("The API Key has to be provided when Firebase Cloud Messaging is enabled")
}
Config.FCM.AfterMessageDelivery = AfterMessageDelivery
sender := fcm.NewSender(*Config.FCM.APIKey)
*Config.FCM.IntervalMetrics = true
if Config.FCM.Endpoint != nil {
gcm.GcmSendEndpoint = *Config.FCM.Endpoint
}
sender := fcm.NewSender(*Config.FCM.APIKey)
if fcmConn, err := fcm.New(router, sender, Config.FCM); err != nil {
logger.WithError(err).Error("Error creating FCM connector")
} else {
Expand Down

0 comments on commit 41fe815

Please sign in to comment.