2024-12-18 18:54:48 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2025-01-10 11:12:03 +00:00
|
|
|
controllers "queryorchestration/api/api"
|
2025-01-07 13:01:14 +00:00
|
|
|
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
2025-01-10 11:12:03 +00:00
|
|
|
"queryorchestration/internal/api"
|
2024-12-24 17:13:48 +00:00
|
|
|
"queryorchestration/internal/collector"
|
|
|
|
|
"queryorchestration/internal/export"
|
|
|
|
|
"queryorchestration/internal/query"
|
2025-01-10 11:12:03 +00:00
|
|
|
"queryorchestration/internal/server"
|
2024-12-18 18:54:48 +00:00
|
|
|
|
|
|
|
|
_ "github.com/lib/pq"
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
2025-01-10 11:12:03 +00:00
|
|
|
controllers := func(cfg *server.Config) *grpc.Server {
|
|
|
|
|
grpcServer := grpc.NewServer()
|
|
|
|
|
serviceinterfaces.RegisterQueryServiceServer(grpcServer, controllers.NewQueryController(*query.New(cfg.Database), cfg.Validator))
|
|
|
|
|
serviceinterfaces.RegisterExportServiceServer(grpcServer, controllers.NewExportController(*export.New(cfg.Database), cfg.Validator))
|
|
|
|
|
serviceinterfaces.RegisterJobCollectorServiceServer(grpcServer, controllers.NewJobCollectorController(*collector.New(cfg.Database), cfg.Validator))
|
2024-12-18 18:54:48 +00:00
|
|
|
|
2025-01-10 11:12:03 +00:00
|
|
|
return grpcServer
|
2024-12-18 18:54:48 +00:00
|
|
|
}
|
|
|
|
|
|
2025-01-10 11:12:03 +00:00
|
|
|
server := api.New(ctx, &api.Config{
|
|
|
|
|
GetControllers: controllers,
|
|
|
|
|
})
|
2024-12-18 18:54:48 +00:00
|
|
|
|
2025-01-10 11:12:03 +00:00
|
|
|
server.Listen()
|
2024-12-18 18:54:48 +00:00
|
|
|
}
|