switch to mongodb uri instead of host/username/password

This commit is contained in:
2023-04-03 20:31:13 +02:00
parent 3d61f9b542
commit 1ba7fef3ef
3 changed files with 38 additions and 6 deletions

View File

@@ -2,12 +2,11 @@ package grpcserver
import (
"context"
"fmt"
"log"
"net"
"git.coopgo.io/coopgo-platform/carpool-incentives/grpc/proto"
"git.coopgo.io/coopgo-platform/carpool-incentives/handlers/incentives"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -78,13 +77,13 @@ func Run(done chan error, cfg *viper.Viper, incentivesHandler *incentives.Incent
dev_env = cfg.GetBool("dev_env")
address = ":" + cfg.GetString("services.grpc.port")
)
//fmt.Println("-> GRPC server on", address)
server := grpc.NewServer()
proto.RegisterCarpoolIncentivesServer(server, NewCarpoolIncentivesServer(incentivesHandler))
l, err := net.Listen("tcp", address)
if err != nil {
log.Fatal(err)
log.Fatal().Err(err).Msg("could not create grpc server")
return
}
if dev_env {
@@ -92,7 +91,7 @@ func Run(done chan error, cfg *viper.Viper, incentivesHandler *incentives.Incent
}
if err := server.Serve(l); err != nil {
fmt.Println("gRPC service ended")
log.Error().Err(err).Msg("grpc service ended")
done <- err
}
}