package runtime import ( "git.sendico.io/tech/sxchnge/product/app/api" "git.sendico.io/tech/sxchnge/product/app/health/status" "git.sendico.io/tech/sxchnge/shared/errors" "git.sendico.io/tech/sxchnge/shared/service" "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 }