diff --git a/cmd/service/main.go b/cmd/service/main.go index e271efe7..6367939e 100644 --- a/cmd/service/main.go +++ b/cmd/service/main.go @@ -13,6 +13,7 @@ import ( impl_service "github.com/podengo-project/idmsvc-backend/internal/infrastructure/service/impl" "github.com/podengo-project/idmsvc-backend/internal/interface/client/rbac" client_inventory "github.com/podengo-project/idmsvc-backend/internal/usecase/client/inventory" + client_pendo "github.com/podengo-project/idmsvc-backend/internal/usecase/client/pendo" client_rbac "github.com/podengo-project/idmsvc-backend/internal/usecase/client/rbac" ) @@ -53,7 +54,8 @@ func main() { ctx, cancel := startSignalHandler(context.Background()) inventory := client_inventory.NewHostInventory(cfg) rbac := initRbacWrapper(ctx, cfg) - s := impl_service.NewApplication(ctx, wg, cfg, db, inventory, rbac) + pendo := client_pendo.NewClient(cfg) + s := impl_service.NewApplication(ctx, wg, cfg, db, inventory, rbac, pendo) if e := s.Start(); e != nil { panic(e) } diff --git a/internal/handler/impl/application.go b/internal/handler/impl/application.go index 9168b0d7..f51c002c 100644 --- a/internal/handler/impl/application.go +++ b/internal/handler/impl/application.go @@ -4,6 +4,7 @@ import ( "github.com/podengo-project/idmsvc-backend/internal/config" "github.com/podengo-project/idmsvc-backend/internal/handler" client_inventory "github.com/podengo-project/idmsvc-backend/internal/interface/client/inventory" + client_pendo "github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" client_rbac "github.com/podengo-project/idmsvc-backend/internal/interface/client/rbac" "github.com/podengo-project/idmsvc-backend/internal/interface/interactor" "github.com/podengo-project/idmsvc-backend/internal/interface/presenter" @@ -41,9 +42,10 @@ type application struct { hostconfjwk hostconfJwkComponent db *gorm.DB inventory client_inventory.HostInventory + pendo client_pendo.Pendo } -func NewHandler(config *config.Config, db *gorm.DB, m *metrics.Metrics, inventory client_inventory.HostInventory, rbac client_rbac.Rbac) handler.Application { +func NewHandler(config *config.Config, db *gorm.DB, m *metrics.Metrics, inventory client_inventory.HostInventory, rbac client_rbac.Rbac, pendo client_pendo.Pendo) handler.Application { if config == nil { panic("config is nil") } @@ -75,5 +77,6 @@ func NewHandler(config *config.Config, db *gorm.DB, m *metrics.Metrics, inventor host: hc, hostconfjwk: hcjc, inventory: inventory, + pendo: pendo, } } diff --git a/internal/infrastructure/service/impl/application.go b/internal/infrastructure/service/impl/application.go index 8c45026e..7c2460e8 100644 --- a/internal/infrastructure/service/impl/application.go +++ b/internal/infrastructure/service/impl/application.go @@ -8,6 +8,7 @@ import ( handler_impl "github.com/podengo-project/idmsvc-backend/internal/handler/impl" "github.com/podengo-project/idmsvc-backend/internal/infrastructure/service" client_inventory "github.com/podengo-project/idmsvc-backend/internal/interface/client/inventory" + client_pendo "github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" client_rbac "github.com/podengo-project/idmsvc-backend/internal/interface/client/rbac" "github.com/podengo-project/idmsvc-backend/internal/metrics" "github.com/prometheus/client_golang/prometheus" @@ -26,7 +27,7 @@ type svcApplication struct { // AdditionalService service.ApplicationService } -func NewApplication(ctx context.Context, wg *sync.WaitGroup, cfg *config.Config, db *gorm.DB, inventory client_inventory.HostInventory, rbac client_rbac.Rbac) service.ApplicationService { +func NewApplication(ctx context.Context, wg *sync.WaitGroup, cfg *config.Config, db *gorm.DB, inventory client_inventory.HostInventory, rbac client_rbac.Rbac, pendo client_pendo.Pendo) service.ApplicationService { if ctx == nil { panic("ctx is nil") } @@ -39,6 +40,15 @@ func NewApplication(ctx context.Context, wg *sync.WaitGroup, cfg *config.Config, if db == nil { panic("db is nil") } + if inventory == nil { + panic("inventory is nil") + } + if rbac == nil { + panic("rbac is nil") + } + if pendo == nil { + panic("pendo is nil") + } s := &svcApplication{} s.Config = cfg @@ -49,7 +59,7 @@ func NewApplication(ctx context.Context, wg *sync.WaitGroup, cfg *config.Config, metrics := metrics.NewMetrics(reg) // Create application handlers - handler := handler_impl.NewHandler(s.Config, db, metrics, inventory, rbac) + handler := handler_impl.NewHandler(s.Config, db, metrics, inventory, rbac, pendo) // Create Metrics service s.Metrics = NewMetrics(s.Context, s.WaitGroup, s.Config, handler)