Files
query-orchestration/cmd/queryRunner/main.go
T
Jay Brown 15adaebfcd Merged in feature/serviceconfig-integration (pull request #38)
DRAFT PR : WIP working through ideas for integration

* movearound

* attempttwo

* openapi

* further sanding

* fix

* start on tests

* runthroughsingleconfig

* somechanges

* reflectissue

* removeerrs

* mostlyremovepanic

* removeenv

* noncfgtests

* go

* repo

* fix service config test

* add PWD to all

* test fix

* fix lint

* todo for later

* passingunittests

* alltests

* testlogger

* testloggername

* clean
2025-01-31 13:43:55 +00:00

61 lines
1.3 KiB
Go

package main
import (
"context"
"log/slog"
"os"
controllers "queryorchestration/api/queryRunner"
"queryorchestration/internal/document"
documentclean "queryorchestration/internal/document/clean"
documenttext "queryorchestration/internal/document/text"
"queryorchestration/internal/job/collector"
"queryorchestration/internal/query"
"queryorchestration/internal/query/result"
"queryorchestration/internal/server/runner"
"queryorchestration/internal/serviceconfig"
_ "github.com/lib/pq"
)
func main() {
ctx := context.Background()
cfg := &runner.BaseConfig{}
if err := serviceconfig.InitializeConfig(cfg); err != nil {
slog.Error("Error initializing config", "err", err)
os.Exit(1)
}
cfg.ControllerFunc = func() runner.Controller {
text := documenttext.New()
clean := documentclean.New()
coll := collector.New(cfg, &collector.Services{
Text: text,
Clean: clean,
})
res := result.New(cfg)
doc := document.New(cfg)
svc := query.New(cfg, &query.Services{
Result: res,
Text: text,
Collector: coll,
Document: doc,
})
c := controllers.NewQueryRunner(cfg.GetValidator(), &controllers.Services{
Query: svc,
})
return &c
}
server, err := runner.New(ctx, cfg)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
server.Listen(ctx)
}