(ctx context.Context, cConfig *csconfig.Config, pluginBroker *csplugin.PluginBroker)
| 519 | } |
| 520 | |
| 521 | func (s *APIServer) InitPlugins(ctx context.Context, cConfig *csconfig.Config, pluginBroker *csplugin.PluginBroker) error { |
| 522 | if hasPlugins(s.cfg.Profiles) { |
| 523 | log.Info("initiating plugin broker") |
| 524 | // On windows, the plugins are always run as medium-integrity processes, so we don't care about plugin_config |
| 525 | if cConfig.PluginConfig == nil && runtime.GOOS != "windows" { |
| 526 | return errors.New("plugins are enabled, but the plugin_config section is missing in the configuration") |
| 527 | } |
| 528 | |
| 529 | if cConfig.ConfigPaths.PluginDir == "" { |
| 530 | return errors.New("plugins are enabled, but config_paths.plugin_dir is not defined") |
| 531 | } |
| 532 | |
| 533 | err := pluginBroker.Init(ctx, cConfig.PluginConfig, s.cfg.Profiles, cConfig.ConfigPaths) |
| 534 | if err != nil { |
| 535 | return fmt.Errorf("plugin broker: %w", err) |
| 536 | } |
| 537 | |
| 538 | log.Info("initiated plugin broker") |
| 539 | s.AttachPluginBroker(pluginBroker) |
| 540 | } |
| 541 | |
| 542 | return nil |
| 543 | } |
| 544 | |
| 545 | func (s *APIServer) InitController() error { |
| 546 | err := s.controller.Init() |
no test coverage detected