This commit is contained in:
@@ -7,15 +7,15 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
_ "github.com/jackc/pgx/v5/stdlib"
|
||||
rkboot "github.com/rookie-ninja/rk-boot/v2"
|
||||
"github.com/rookie-ninja/rk-entry/v2/entry"
|
||||
rkentry "github.com/rookie-ninja/rk-entry/v2/entry"
|
||||
rkgrpc "github.com/rookie-ninja/rk-grpc/v2/boot"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"smart-search-back/internal/config"
|
||||
"smart-search-back/internal/database"
|
||||
grpcServer "smart-search-back/internal/grpc"
|
||||
"smart-search-back/internal/repository"
|
||||
"smart-search-back/internal/worker"
|
||||
"git.techease.ru/Smart-search/smart-search-back/internal/config"
|
||||
"git.techease.ru/Smart-search/smart-search-back/internal/database"
|
||||
grpcServer "git.techease.ru/Smart-search/smart-search-back/internal/grpc"
|
||||
"git.techease.ru/Smart-search/smart-search-back/internal/repository"
|
||||
"git.techease.ru/Smart-search/smart-search-back/internal/worker"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -24,21 +24,7 @@ func main() {
|
||||
log.Fatalf("Failed to load config: %v", err)
|
||||
}
|
||||
|
||||
boot := rkboot.NewBoot(rkboot.WithBootConfigPath("config/boot.yaml", nil))
|
||||
|
||||
ctx := context.Background()
|
||||
boot.Bootstrap(ctx)
|
||||
|
||||
grpcEntry := rkgrpc.GetGrpcEntry("smart-search-service")
|
||||
if grpcEntry == nil {
|
||||
log.Fatal("Failed to get gRPC entry from rk-boot")
|
||||
}
|
||||
|
||||
loggerEntry := rkentry.GlobalAppCtx.GetLoggerEntry("smart-search-service")
|
||||
if loggerEntry == nil {
|
||||
loggerEntry = rkentry.GlobalAppCtx.GetLoggerEntryDefault()
|
||||
}
|
||||
logger := loggerEntry.Logger
|
||||
|
||||
if err := database.RunMigrations(cfg.DatabaseURL()); err != nil {
|
||||
log.Fatalf("Failed to run migrations: %v", err)
|
||||
@@ -56,6 +42,19 @@ func main() {
|
||||
|
||||
log.Println("Successfully connected to database")
|
||||
|
||||
boot := rkboot.NewBoot(rkboot.WithBootConfigPath("config/boot.yaml", nil))
|
||||
|
||||
grpcEntry := rkgrpc.GetGrpcEntry("smart-search-service")
|
||||
if grpcEntry == nil {
|
||||
log.Fatal("Failed to get gRPC entry from rk-boot")
|
||||
}
|
||||
|
||||
loggerEntry := rkentry.GlobalAppCtx.GetLoggerEntry("smart-search-service")
|
||||
if loggerEntry == nil {
|
||||
loggerEntry = rkentry.GlobalAppCtx.GetLoggerEntryDefault()
|
||||
}
|
||||
logger := loggerEntry.Logger
|
||||
|
||||
sessionRepo := repository.NewSessionRepository(pool)
|
||||
inviteRepo := repository.NewInviteRepository(pool)
|
||||
|
||||
@@ -80,6 +79,8 @@ func main() {
|
||||
grpcServer.RegisterServices(s, authHandler, userHandler, inviteHandler, requestHandler, supplierHandler)
|
||||
})
|
||||
|
||||
boot.Bootstrap(ctx)
|
||||
|
||||
log.Println("gRPC server started via rk-boot on port 9091")
|
||||
|
||||
boot.WaitForShutdownSig(ctx)
|
||||
|
||||
Reference in New Issue
Block a user