package runtime import ( "git.sendico.io/tech/sxchnge/bff/edge/shared/interface/api" "git.sendico.io/tech/sxchnge/bff/pkg/api/routers/health" "git.sendico.io/tech/sxchnge/bff/pkg/merrors" "git.sendico.io/tech/sxchnge/bff/pkg/mservice" "go.uber.org/zap" ) func (a *APIImp) installMicroservice(srv mservice.MicroService) { a.services = append(a.services, srv) a.logger.Info("Microservice installed", zap.String("service", srv.Name())) } func (a *APIImp) addMicroservice(srvf api.MicroServiceFactoryT) error { srv, err := srvf(a) if err != nil { a.logger.Error("Failed to install a microservice", zap.Error(err)) return err } a.installMicroservice(srv) return nil } func (a *APIImp) installServices() error { for _, service := range a.runtime.Services { if service.Factory == nil { return merrors.InvalidArgument("microservice factory is required", "runtime.services") } if err := a.addMicroservice(service.Factory); err != nil { return err } } a.health.SetStatus(health.SSRunning) return nil }