Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into deploy
  • Loading branch information
source-Alexander-Rudenko committed Dec 21, 2024
2 parents 539113b + 1784f40 commit 45fe48a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func main() {
log.Fatalf("Failed to connect to auth service: %v", err)
}

userHandler, err := userHandlers.NewHandlers(conf.UserServiceAddr, appLogger)
userHandler, err := userHandlers.NewHandlers(conf.UserServiceAddr, conf.ImageServiceAddr, appLogger)
if err != nil {
log.Fatalf("Failed to connect to user service: %v", err)
}
Expand Down
11 changes: 8 additions & 3 deletions internal/gateway/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
pbImage "kudago/internal/image/api"
"kudago/internal/logger"
pb "kudago/internal/user/api"
user "kudago/internal/user/api"

"github.com/asaskevich/govalidator"
"google.golang.org/grpc"
Expand All @@ -31,14 +30,20 @@ type UserHandlers struct {
logger *logger.Logger
}

func NewHandlers(userServiceAddr string, logger *logger.Logger) (*UserHandlers, error) {
func NewHandlers(userServiceAddr string, imageServiceAddr string, logger *logger.Logger) (*UserHandlers, error) {
authConn, err := grpc.NewClient(userServiceAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
}

imageConn, err := grpc.NewClient(imageServiceAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
}

return &UserHandlers{
UserService: user.NewUserServiceClient(authConn),
UserService: pb.NewUserServiceClient(authConn),
ImageService: pbImage.NewImageServiceClient(imageConn),
logger: logger,
}, nil
}
Expand Down

0 comments on commit 45fe48a

Please sign in to comment.