From 4f8b610ad1fa5e4edee2dd7e1ceeaa9f50be62a6 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Sat, 26 Jul 2025 14:45:01 +0200 Subject: [PATCH] update search source connector schame --- .../app/schemas/search_source_connector.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/surfsense_backend/app/schemas/search_source_connector.py b/surfsense_backend/app/schemas/search_source_connector.py index 9c43d07..939ed1c 100644 --- a/surfsense_backend/app/schemas/search_source_connector.py +++ b/surfsense_backend/app/schemas/search_source_connector.py @@ -143,6 +143,26 @@ class SearchSourceConnectorBase(BaseModel): if not config.get("JIRA_BASE_URL"): raise ValueError("JIRA_BASE_URL cannot be empty") + elif connector_type == SearchSourceConnectorType.CONFLUENCE_CONNECTOR: + # For CONFLUENCE_CONNECTOR, only allow specific keys + allowed_keys = ["CONFLUENCE_BASE_URL", "CONFLUENCE_EMAIL", "CONFLUENCE_API_TOKEN"] + if set(config.keys()) != set(allowed_keys): + raise ValueError( + f"For CONFLUENCE_CONNECTOR connector type, config must only contain these keys: {allowed_keys}" + ) + + # Ensure the email is not empty + if not config.get("CONFLUENCE_EMAIL"): + raise ValueError("CONFLUENCE_EMAIL cannot be empty") + + # Ensure the API token is not empty + if not config.get("CONFLUENCE_API_TOKEN"): + raise ValueError("CONFLUENCE_API_TOKEN cannot be empty") + + # Ensure the base URL is not empty + if not config.get("CONFLUENCE_BASE_URL"): + raise ValueError("CONFLUENCE_BASE_URL cannot be empty") + return config