a6e081e5cd
inject and print version at startup for all services * inject and print version * coverage
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
// **Listens For**: S3 Event
|
|
//
|
|
// **Action**.
|
|
//
|
|
// It will identify the type of event and the location of said event, and forward the task accordingly.
|
|
//
|
|
// It supports the document initialisation and document text processing stages. Events may be pushed to the DOCINIT queue.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
"os"
|
|
|
|
storeeventrunner "queryorchestration/api/storeEventRunner"
|
|
documentstore "queryorchestration/internal/document/store"
|
|
"queryorchestration/internal/server/runner"
|
|
"queryorchestration/internal/serviceconfig/build"
|
|
"queryorchestration/internal/serviceconfig/queue/documentinit"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
type StoreEventConfig struct {
|
|
runner.BaseConfig[storeeventrunner.S3EventNotification]
|
|
documentinit.DocInitConfig
|
|
}
|
|
|
|
func main() {
|
|
// Print version information before any environment checks
|
|
build.PrintVersionInfo("storeEventRunner")
|
|
|
|
ctx := context.Background()
|
|
|
|
cfg := &StoreEventConfig{}
|
|
|
|
cfg.ControllerFunc = func() runner.Controller[storeeventrunner.S3EventNotification] {
|
|
store := documentstore.New(cfg)
|
|
|
|
return storeeventrunner.New(&storeeventrunner.Services{
|
|
Store: store,
|
|
})
|
|
}
|
|
|
|
server, err := runner.New(ctx, cfg)
|
|
if err != nil {
|
|
slog.Error(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
|
|
server.Listen(ctx)
|
|
}
|