Newer
Older
"code.fbi.h-da.de/danet/costaquanta/ctrl/internal/core/ports"
"code.fbi.h-da.de/danet/costaquanta/ctrl/internal/infrastructure/interaction"
"code.fbi.h-da.de/danet/costaquanta/ctrl/internal/infrastructure/store"
"code.fbi.h-da.de/danet/costaquanta/ctrl/internal/service"
"code.fbi.h-da.de/danet/costaquanta/libs/logging"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.uber.org/zap"
)
type Application struct {
tracer *sdktrace.TracerProvider
HealthServer *interaction.HealthServer
RoutingService ports.RoutingService
RoutingServer *interaction.RoutingServer
KmsStore ports.KmsStore
}
func NewApplication(log *zap.Logger, tracer *sdktrace.TracerProvider) *Application {
healthLogger := logging.CreateChildLogger(log, "healthServer")
healthTracer := tracer.Tracer("healthServer")
healthSrv := interaction.NewHealthServer(healthLogger, healthTracer)
routingServiceLogger := logging.CreateChildLogger(log, "routingService")
routingServiceTracer := tracer.Tracer("routingService")
rSrv := service.NewRoutingService(routingServiceLogger, routingServiceTracer)
routingLogger := logging.CreateChildLogger(log, "routingServer")
routingTracer := tracer.Tracer("routingServer")
routerSrv := interaction.NewRoutingServer(routingLogger, routingTracer, rSrv)
// Create the in-memory KMS store, as we currently have no other option.
// Can be replaced by a store choice via flags or config file later.
kmsStoreLogger := logging.CreateChildLogger(log, "KmsStore")
kmsStoreTracer := tracer.Tracer("KmsStore")
kmsStore := store.NewInMemoryKmsStore(kmsStoreLogger, kmsStoreTracer)
tracer: tracer,
HealthServer: healthSrv,
RoutingServer: routerSrv,
RoutingService: rSrv,
KmsStore: kmsStore,