Skip to content

Commit

Permalink
Get credentials from viper directly
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelreiswildlife committed Mar 25, 2024
1 parent b12db85 commit 5914272
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ type (
}

GCM struct {
Apps string
PingInterval int
PingTimeout int
MaxPendingMessages int
LogStatsInterval int
FirebaseCredentials map[string]string
Apps string
PingInterval int
PingTimeout int
MaxPendingMessages int
LogStatsInterval int
}
)

Expand Down
4 changes: 2 additions & 2 deletions pusher/gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ func (g *GCMPusher) createMessageHandlerForApps() error {

g.MessageHandler = make(map[string]interfaces.MessageHandler)
for _, app := range g.Config.GetAppsArray() {
credentials, ok := g.Config.GCM.FirebaseCredentials[app]
credentials := g.ViperConfig.GetString("gcm.firebaseCredentials." + app)
l = l.WithField("app", app)
if ok { // Firebase is configured, use new handler
if credentials != "" { // Firebase is configured, use new handler
pushClient, err := client.NewFirebaseClient(credentials, g.Logger)
if err != nil {
l.WithError(err).Error("could not create firebase client")
Expand Down

0 comments on commit 5914272

Please sign in to comment.