2024-02-21 14:58:51 +00:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
2024-04-13 11:26:44 +00:00
|
|
|
idpb "git.solsynth.dev/hydrogen/passport/pkg/grpc/proto"
|
2024-02-21 14:58:51 +00:00
|
|
|
"google.golang.org/grpc/credentials/insecure"
|
|
|
|
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
)
|
|
|
|
|
2024-05-04 14:22:58 +00:00
|
|
|
var Realms idpb.RealmsClient
|
2024-04-06 04:05:54 +00:00
|
|
|
var Friendships idpb.FriendshipsClient
|
2024-03-26 14:49:12 +00:00
|
|
|
var Notify idpb.NotifyClient
|
|
|
|
var Auth idpb.AuthClient
|
2024-02-21 14:58:51 +00:00
|
|
|
|
|
|
|
func ConnectPassport() error {
|
2024-04-13 11:26:44 +00:00
|
|
|
addr := viper.GetString("passport.grpc_endpoint")
|
2024-02-21 14:58:51 +00:00
|
|
|
if conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())); err != nil {
|
|
|
|
return err
|
|
|
|
} else {
|
2024-05-04 14:22:58 +00:00
|
|
|
Realms = idpb.NewRealmsClient(conn)
|
2024-04-06 04:05:54 +00:00
|
|
|
Friendships = idpb.NewFriendshipsClient(conn)
|
2024-03-26 14:49:12 +00:00
|
|
|
Notify = idpb.NewNotifyClient(conn)
|
|
|
|
Auth = idpb.NewAuthClient(conn)
|
2024-02-21 14:58:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|