Skip to content

Commit

Permalink
allow disabling SSL check to confluence server
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ committed Jun 11, 2024
1 parent f3b923d commit 2930108
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions confluence_vector_sync/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ def get_config():
"index_attachments": os.getenv("INDEX_ATTACHMENTS", "false").lower() == "true",
"attachment_indexer_type": os.getenv("ATTACHMENT_INDEXER_TYPE", "AZURE_DOCUMENT_INTELLIGENCE"),
"media_handlers": media_handlers,
"ignore_confluence_cert": os.getenv("IGNORE_CONFLUENCE_CERT", "false").lower() == "true"
}
10 changes: 8 additions & 2 deletions confluence_vector_sync/confluence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import datetime, timezone
import tempfile
import requests
import urllib3
from atlassian import Confluence
from bs4 import BeautifulSoup
from langchain.text_splitter import RecursiveCharacterTextSplitter
Expand All @@ -17,8 +18,12 @@ class ConfluenceWrapper:
handle_attachments = False
datetime_format = '%Y-%m-%dT%H:%M:%S.%fZ'

def __init__(self, url, username, password, auth_method="PASSWORD", extra_headers=[]):
def __init__(self, url, username, password, auth_method="PASSWORD", extra_headers=[], ignore_ssl=False):
session = requests.Session()
if ignore_ssl:
session.verify = False
urllib3.disable_warnings()
print("SSL verification disabled")
for extra in extra_headers:
session.headers.update(extra)
if auth_method == "PASSWORD":
Expand Down Expand Up @@ -151,4 +156,5 @@ def confluence_from_config(config: Dict[str, str]) -> ConfluenceWrapper:
username=config["confluence_user_name"],
password=config["confluence_password"],
auth_method=config["confluence_auth_method"],
extra_headers=config["confluence_extra_headers"])
extra_headers=config["confluence_extra_headers"],
ignore_ssl=config["ignore_confluence_cert"])

0 comments on commit 2930108

Please sign in to comment.