IsIntegrationEnabled checks if an integration is enabled Returns false if not specified (default behavior - integrations are disabled by default) For compliance, returns true if enabled (true) or on-demand ("on-demand"), false if disabled
(name string)
| 454 | // Returns false if not specified (default behavior - integrations are disabled by default) |
| 455 | // For compliance, returns true if enabled (true) or on-demand ("on-demand"), false if disabled |
| 456 | func (m *Manager) IsIntegrationEnabled(name string) bool { |
| 457 | if m.config.Integrations == nil { |
| 458 | return false |
| 459 | } |
| 460 | val, exists := m.config.Integrations[name] |
| 461 | if !exists { |
| 462 | return false |
| 463 | } |
| 464 | |
| 465 | // Special handling for compliance (can be false, "on-demand", or true; may be nested) |
| 466 | if name == "compliance" { |
| 467 | enabledVal := m.getComplianceVal("enabled") |
| 468 | if enabledVal == nil { |
| 469 | return false |
| 470 | } |
| 471 | switch v := enabledVal.(type) { |
| 472 | case bool: |
| 473 | return v |
| 474 | case string: |
| 475 | return v == "on-demand" || v == "on_demand" || v == "true" |
| 476 | default: |
| 477 | return false |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | // For other integrations, expect bool |
| 482 | if enabled, ok := val.(bool); ok { |
| 483 | return enabled |
| 484 | } |
| 485 | return false |
| 486 | } |
| 487 | |
| 488 | // SetIntegrationEnabled sets the enabled status for an integration |
| 489 | // For compliance, use SetComplianceMode() instead for three-state control |
no test coverage detected