replacing depracated grpc Dial + camelcases vars + fixing issues
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||
ma "git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
@@ -15,7 +16,8 @@ type MobilityAccountService struct {
|
||||
}
|
||||
|
||||
func NewMobilityAccountService(mobilityAccountsDial string) (MobilityAccountService, error) {
|
||||
mobilityAccountsConn, err := grpc.Dial(mobilityAccountsDial, grpc.WithInsecure())
|
||||
mobilityAccountsConn, err := grpc.NewClient(mobilityAccountsDial,
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
|
||||
client := mobilityaccounts.NewMobilityAccountsClient(mobilityAccountsConn)
|
||||
if err != nil {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/appleboy/gorush/rpc/proto"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
@@ -36,7 +37,8 @@ type PushService struct {
|
||||
}
|
||||
|
||||
func NewPushService(address string) (*PushService, error) {
|
||||
conn, err := grpc.Dial(address, grpc.WithInsecure())
|
||||
conn, err := grpc.NewClient(address,
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -48,6 +50,12 @@ func NewPushService(address string) (*PushService, error) {
|
||||
}
|
||||
|
||||
func (s *PushService) Send(notification Notification) error {
|
||||
|
||||
var (
|
||||
resp *proto.NotificationReply
|
||||
err error
|
||||
)
|
||||
|
||||
log.Debug().
|
||||
Int32("Platform", notification.Platform).
|
||||
Strs("recipients", notification.Recipients).
|
||||
@@ -55,7 +63,7 @@ func (s *PushService) Send(notification Notification) error {
|
||||
Str("notification_title", notification.Title).
|
||||
Msg("Send notification")
|
||||
|
||||
if resp, err := s.Client.Send(context.Background(), &proto.NotificationRequest{
|
||||
if resp, err = s.Client.Send(context.Background(), &proto.NotificationRequest{
|
||||
Data: notification.Data,
|
||||
ID: notification.ID,
|
||||
Platform: notification.Platform,
|
||||
|
||||
@@ -2,7 +2,7 @@ package services
|
||||
|
||||
import (
|
||||
"git.coopgo.io/coopgo-platform/geocode"
|
||||
routing "git.coopgo.io/coopgo-platform/routing-service"
|
||||
"git.coopgo.io/coopgo-platform/routing-service"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user