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

Commit

Permalink
feat: add the ability to use self-signed cert for MinIO server with M…
Browse files Browse the repository at this point in the history
…inioReader
  • Loading branch information
Ferdinando Simonetti committed Feb 8, 2024
1 parent be02528 commit 0f89e44
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 0f89e44

Please sign in to comment.