Files
query-orchestration/cmd/queryService/main.go
T
Jay Brown 174644b63c Merged in jb/openapi (pull request #22)
add openapi infra

* add openapi infra

Includes generated stubs and all deps

* generatetolocation

* basesetupoffunctionsandclient

* round1controllertests

* passintegrationtests

* cleanupfromfullsuite

* storedjson

* fixjsonyaml

* fixtests


Approved-by: Michael McGuinness
2025-01-15 19:45:51 +00:00

51 lines
1.0 KiB
Go

package main
import (
"context"
"log"
queryservice "queryorchestration/api/queryService"
"queryorchestration/internal/api"
"queryorchestration/internal/collector"
"queryorchestration/internal/export"
"queryorchestration/internal/query"
"queryorchestration/internal/server"
"github.com/labstack/echo/v4"
_ "github.com/lib/pq"
)
func main() {
ctx := context.Background()
registerHandlers := func(cfg *server.Config, e *echo.Echo) *api.APIConfig {
exp := export.New(cfg.Database)
col := collector.New(cfg.Database)
que := query.New(cfg.Database)
services := &queryservice.Services{
Export: exp,
JobCollector: col,
Query: que,
}
cons := queryservice.NewControllers(cfg.Validator, services)
queryservice.RegisterHandlersWithBaseURL(e, cons, "")
swagger, err := queryservice.GetSwagger()
if err != nil {
log.Panicf("Error loading swagger: %s", err)
}
return &api.APIConfig{
Swagger: swagger,
}
}
server := api.New(ctx, &api.Config{
RegisterHandlers: registerHandlers,
})
server.Listen()
}