|
20 | 20 | HOLMES_ENABLED, |
21 | 21 | SLACK_REQUEST_TIMEOUT, |
22 | 22 | SLACK_TABLE_COLUMNS_LIMIT, |
| 23 | + SLACK_PROXY_URL, |
23 | 24 | ) |
24 | 25 | from robusta.core.reporting.base import Emojis, EnrichmentType, Finding, FindingStatus, LinkType |
25 | 26 | from robusta.core.reporting.blocks import ( |
@@ -77,21 +78,26 @@ def __init__(self, slack_token: str, account_id: str, cluster_name: str, signing |
77 | 78 | ssl=ssl_context, |
78 | 79 | timeout=SLACK_REQUEST_TIMEOUT, |
79 | 80 | retry_handlers=all_builtin_retry_handlers(), |
| 81 | + proxy=SLACK_PROXY_URL |
80 | 82 | ) |
| 83 | + if SLACK_PROXY_URL: |
| 84 | + logging.info(f"Slack client configured to use proxy: {SLACK_PROXY_URL}") |
| 85 | + |
81 | 86 | self.registry = registry |
82 | 87 | self.signing_key = signing_key |
83 | 88 | self.account_id = account_id |
84 | 89 | self.cluster_name = cluster_name |
85 | 90 | self.is_preview = is_preview |
86 | 91 | self.disable_holmes_note = disable_holmes_note |
87 | 92 |
|
88 | | - if slack_token not in self.verified_api_tokens: |
89 | | - try: |
90 | | - self.slack_client.auth_test() |
91 | | - self.verified_api_tokens.add(slack_token) |
92 | | - except SlackApiError as e: |
93 | | - logging.error(f"Cannot connect to Slack API: {e}") |
94 | | - raise e |
| 93 | + if SLACK_PROXY_URL is None: |
| 94 | + if slack_token not in self.verified_api_tokens: |
| 95 | + try: |
| 96 | + self.slack_client.auth_test() |
| 97 | + self.verified_api_tokens.add(slack_token) |
| 98 | + except SlackApiError as e: |
| 99 | + logging.error(f"Cannot connect to Slack API: {e}") |
| 100 | + raise e |
95 | 101 |
|
96 | 102 | def __slack_preview_sanitize_string(self, text: str) -> str: |
97 | 103 | """ |
|
0 commit comments