Files
query-orchestration/cmd/docTextRunner/main.go
T
Jay Brown a6e081e5cd Merged in feature/log-version (pull request #185)
inject and print version at startup for all services

* inject and print version

* coverage
2025-09-18 21:06:21 +00:00

69 lines
1.5 KiB
Go

// **Listens For**: Body Containing Document ID
//
// **Action**.
//
// If the document text is not already extracted according to the collector standards, trigger the textract job for text detection.
//
// Otherwise, add an event to the QUERYSYNC queue.
package main
import (
"context"
"log/slog"
"os"
doctextrunner "queryorchestration/api/docTextRunner"
documenttext "queryorchestration/internal/document/text"
"queryorchestration/internal/server/runner"
"queryorchestration/internal/serviceconfig/build"
"queryorchestration/internal/serviceconfig/objectstore"
"queryorchestration/internal/serviceconfig/queue/querysync"
"queryorchestration/internal/serviceconfig/textract"
_ "github.com/lib/pq"
)
type DocTextConfig struct {
runner.BaseConfig[doctextrunner.Body]
textract.TextractConfig
querysync.QuerySyncConfig
objectstore.ObjectStoreConfig
}
func main() {
// Print version information before any environment checks
build.PrintVersionInfo("docTextRunner")
ctx := context.Background()
cfg := &DocTextConfig{}
cfg.ControllerFunc = func() runner.Controller[doctextrunner.Body] {
text := documenttext.New(cfg)
return doctextrunner.New(&doctextrunner.Services{
Text: text,
})
}
server, err := runner.New(ctx, cfg)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
err = cfg.SetStoreClient(ctx)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
err = cfg.SetTextractClient(ctx)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
server.Listen(ctx)
}