Files
lincodex/backend/internal/bootstrap/wire_gen.go
T

75 lines
2.3 KiB
Go

// Code generated by Wire. DO NOT EDIT.
//go:generate go run -mod=mod github.com/goforj/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package bootstrap
import (
"context"
"lincodex/backend/config"
"lincodex/backend/internal/adapter/primary/http"
"lincodex/backend/internal/adapter/primary/http/problem"
"lincodex/backend/internal/adapter/primary/http/v1"
"lincodex/backend/internal/adapter/secondary/postgres"
"lincodex/backend/internal/adapter/secondary/prometheus"
"lincodex/backend/internal/adapter/secondary/redis"
"lincodex/backend/internal/adapter/secondary/seaweedfs"
"lincodex/backend/internal/port/inbound"
"lincodex/backend/internal/port/outbound"
"lincodex/backend/internal/usecase/health"
"log/slog"
)
// Injectors from wire.go:
// initialize receives the mail sender that start selected, so an unusable
// EMAIL_PROVIDER fails before any dependency is created.
func initialize(ctx context.Context, config2 config.Config, logger *slog.Logger, mailSender outbound.MailSender) (*Application, func(), error) {
healthChecker, cleanup, err := postgres.NewHealthChecker(ctx, config2)
if err != nil {
return nil, nil, err
}
cache, cleanup2, err := redis.NewCache(config2, logger)
if err != nil {
cleanup()
return nil, nil, err
}
storage, cleanup3, err := seaweedfs.NewStorage(config2)
if err != nil {
cleanup2()
cleanup()
return nil, nil, err
}
readiness := newReadiness(healthChecker, cache, storage)
healthHandler := newHealthHandler(readiness, config2)
responder := problem.NewResponder(logger)
handler := v1.NewHandler(healthHandler, responder)
denyAllSecurity := v1.NewDenyAllSecurity()
metrics := prometheus.New()
httpHandler, err := httpadapter.NewRouter(healthHandler, handler, denyAllSecurity, responder, metrics, logger)
if err != nil {
cleanup3()
cleanup2()
cleanup()
return nil, nil, err
}
application := NewApplication(config2, httpHandler, metrics, logger, mailSender)
return application, func() {
cleanup3()
cleanup2()
cleanup()
}, nil
}
// wire.go:
func newHealthHandler(readiness inbound.Readiness, config2 config.Config) *v1.HealthHandler {
return v1.NewHealthHandler(readiness, config2.ReadinessTimeout)
}
func newReadiness(postgres2 *postgres.HealthChecker, cache *redis.Cache, storage *seaweedfs.Storage) *health.Readiness {
return health.NewReadiness(postgres2, cache, storage)
}