✨ Use uni-token
💄 A lot of optimization
This commit is contained in:
24
pkg/grpc/client.go
Normal file
24
pkg/grpc/client.go
Normal file
@ -0,0 +1,24 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
pwpb "code.smartsheep.studio/hydrogen/identity/pkg/grpc/proto"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
var Notify pwpb.NotifyClient
|
||||
var Auth pwpb.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 {
|
||||
Notify = pwpb.NewNotifyClient(conn)
|
||||
Auth = pwpb.NewAuthClient(conn)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user