(ctx context.Context)
| 285 | } |
| 286 | |
| 287 | func (s *APIServer) initAPIC(ctx context.Context) { |
| 288 | s.apic.pushTomb.Go(func() error { |
| 289 | defer trace.ReportPanic() |
| 290 | return s.apicPush(ctx) |
| 291 | }) |
| 292 | s.apic.pullTomb.Go(func() error { |
| 293 | defer trace.ReportPanic() |
| 294 | return s.apicPull(ctx) |
| 295 | }) |
| 296 | |
| 297 | if s.apic.apiClient.IsEnrolled() { |
| 298 | if s.papi != nil { |
| 299 | if s.papi.URL != "" { |
| 300 | log.Info("Starting PAPI decision receiver") |
| 301 | s.papi.pullTomb.Go(func() error { |
| 302 | defer trace.ReportPanic() |
| 303 | return s.papiPull(ctx) |
| 304 | }) |
| 305 | s.papi.syncTomb.Go(func() error { |
| 306 | defer trace.ReportPanic() |
| 307 | return s.papiSync(ctx) |
| 308 | }) |
| 309 | } else { |
| 310 | log.Warnf("papi_url is not set in online_api_credentials.yaml, can't synchronize with the console. Run cscli console enable console_management to add it.") |
| 311 | } |
| 312 | } else { |
| 313 | log.Warningf("Machine is not allowed to synchronize decisions, you can enable it with `cscli console enable console_management`") |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | s.apic.metricsTomb.Go(func() error { |
| 318 | defer trace.ReportPanic() |
| 319 | s.apic.SendMetrics(ctx, make(chan bool)) |
| 320 | return nil |
| 321 | }) |
| 322 | |
| 323 | if !s.cfg.DisableUsageMetricsExport { |
| 324 | s.apic.metricsTomb.Go(func() error { |
| 325 | defer trace.ReportPanic() |
| 326 | s.apic.SendUsageMetrics(ctx) |
| 327 | return nil |
| 328 | }) |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | func (s *APIServer) Run(ctx context.Context, apiReady chan bool) error { |
| 333 | tlsCfg, err := s.cfg.TLS.GetTLSConfig() |
no test coverage detected