♻️ Use paperclip to store avatar and more
This commit is contained in:
@ -30,8 +30,8 @@ func (v *Server) Authenticate(_ context.Context, in *proto.AuthRequest) (*proto.
|
||||
Name: user.Name,
|
||||
Nick: user.Nick,
|
||||
Email: user.GetPrimaryEmail().Content,
|
||||
Avatar: fmt.Sprintf("https://%s/api/avatar/%s", viper.GetString("domain"), user.Avatar),
|
||||
Banner: fmt.Sprintf("https://%s/api/avatar/%s", viper.GetString("domain"), user.Banner),
|
||||
Avatar: fmt.Sprintf("%s/api/attachments/%s", viper.GetString("paperclip.endpoint"), user.Avatar),
|
||||
Banner: fmt.Sprintf("%s/api/attachments/%s", viper.GetString("paperclip.endpoint"), user.Banner),
|
||||
Description: &user.Description,
|
||||
},
|
||||
}, nil
|
||||
|
21
pkg/grpc/client.go
Normal file
21
pkg/grpc/client.go
Normal file
@ -0,0 +1,21 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
pcpb "git.solsynth.dev/hydrogen/paperclip/pkg/grpc/proto"
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
var Attachments pcpb.AttachmentsClient
|
||||
|
||||
func ConnectPaperclip() error {
|
||||
addr := viper.GetString("paperclip.grpc_endpoint")
|
||||
if conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())); err != nil {
|
||||
return err
|
||||
} else {
|
||||
Attachments = pcpb.NewAttachmentsClient(conn)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user