Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

feat: allow use of self-signed cert for MinIO server with MinioReader #935

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llama_hub/minio/minio-client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(
file_metadata: Optional[Callable[[str], Dict]] = None,
minio_endpoint: Optional[str] = None,
minio_secure: bool = False,
minio_cert_check: bool = False,
minio_access_key: Optional[str] = None,
minio_secret_key: Optional[str] = None,
minio_session_token: Optional[str] = None,
Expand Down Expand Up @@ -59,6 +60,8 @@ def __init__(
minio_access_key (Optional[str]): The Minio access key. Default is None.
minio_secret_key (Optional[str]): The Minio secret key. Default is None.
minio_session_token (Optional[str]): The Minio session token.
minio_secure: MinIO server runs in TLS mode
minio_cert_check: allows the usage of a self-signed cert for MinIO server
"""
super().__init__(*args, **kwargs)

Expand All @@ -74,6 +77,7 @@ def __init__(

self.minio_endpoint = minio_endpoint
self.minio_secure = minio_secure
self.minio_cert_check = minio_cert_check
self.minio_access_key = minio_access_key
self.minio_secret_key = minio_secret_key
self.minio_session_token = minio_session_token
Expand All @@ -85,11 +89,16 @@ def load_data(self) -> List[Document]:
minio_client = Minio(
self.minio_endpoint,
secure=self.minio_secure,
cert_check=self.minio_cert_check,
access_key=self.minio_access_key,
secret_key=self.minio_secret_key,
session_token=self.minio_session_token,
)

if not self.minio_cert_check:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

with tempfile.TemporaryDirectory() as temp_dir:
if self.key:
suffix = Path(self.key).suffix
Expand Down
Loading