[backend] xtm-hub: add configuration to disable connectivity email notifications (#12988) #12990
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
xtmhub_connectivity_email_enabledto control Hub connectivity lost email notificationscheckXTMHubConnectivity()to check configuration before sending emailsRelated issues
Checklist
Further comments
Context:
On demo instances that are reset daily, the Hub connectivity check fails regularly because the registration state becomes invalid after each reset. This triggers automated emails to administrators every 24 hours, causing email spam.
Solution:
This PR adds a new environment variable
OPENCTI__XTM__XTMHUB_CONNECTIVITY_EMAIL_ENABLED(default:true) to control email notifications while keeping all other functionality intact:✅ What continues to work:
hub_registration_manager)❌ What can be disabled:
Usage for demo instances:
Set environment variable:
OPENCTI__XTM__XTMHUB_CONNECTIVITY_EMAIL_ENABLED=falseFiles changed:
config/default.json- Added configuration with default valuetruesrc/domain/xtm-hub.ts- Added configuration check before sending emailstests/01-unit/domain/xtm-hub-test.ts- Added test case for disabled emails scenarioBackward compatibility:
The default value is
true, preserving the current behavior for all existing instances. Only instances that explicitly set the variable tofalsewill have emails disabled.Testing:
Added unit test
should not send connectivity email when email sending is disabled via configurationthat verifies:false