MCPcopy Create free account
hub / github.com/clouditor/clouditor / NewService

Function NewService

service/evaluation/evaluation.go:142–169  ·  view source on GitHub ↗

NewService creates a new Evaluation service

(opts ...service.Option[*Service])

Source from the content-addressed store, hash-verified

140
141// NewService creates a new Evaluation service
142func NewService(opts ...service.Option[*Service]) *Service {
143 var err error
144 svc := Service{
145 orchestrator: api.NewRPCConnection(DefaultOrchestratorAddress, orchestrator.NewOrchestratorClient),
146 scheduler: gocron.NewScheduler(time.Local),
147 catalogControls: make(map[string]map[string]*orchestrator.Control),
148 }
149
150 // Apply service options
151 for _, o := range opts {
152 o(&svc)
153 }
154
155 // Default to an in-memory storage, if nothing was explicitly set
156 if svc.storage == nil {
157 svc.storage, err = inmemory.NewStorage()
158 if err != nil {
159 log.Errorf("Could not initialize the storage: %v", err)
160 }
161 }
162
163 // Default to an allow-all authorization strategy
164 if svc.authz == nil {
165 svc.authz = &service.AuthorizationStrategyAllowAll{}
166 }
167
168 return &svc
169}
170
171func (svc *Service) Init() {}
172

Callers 1

TestNewServiceFunction · 0.70

Calls 3

NewRPCConnectionFunction · 0.92
NewStorageFunction · 0.92
ErrorfMethod · 0.80

Tested by 1

TestNewServiceFunction · 0.56