Messaging/pkg/grpc/client.go

27 lines
626 B
Go
Raw Normal View History

2024-03-26 15:05:13 +00:00
package grpc
import (
idpb "git.solsynth.dev/hydrogen/identity/pkg/grpc/proto"
"google.golang.org/grpc/credentials/insecure"
"github.com/spf13/viper"
"google.golang.org/grpc"
)
2024-04-06 06:36:36 +00:00
var Friendships idpb.FriendshipsClient
2024-03-26 15:05:13 +00:00
var Notify idpb.NotifyClient
var Auth idpb.AuthClient
func ConnectPassport() error {
addr := viper.GetString("identity.grpc_endpoint")
if conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())); err != nil {
return err
} else {
2024-04-06 06:36:36 +00:00
Friendships = idpb.NewFriendshipsClient(conn)
2024-03-26 15:05:13 +00:00
Notify = idpb.NewNotifyClient(conn)
Auth = idpb.NewAuthClient(conn)
}
return nil
}