From b06c888d8319752429096d9a33d8a6a84cc2062a Mon Sep 17 00:00:00 2001 From: Ferdinando Simonetti Date: Thu, 15 Feb 2024 20:38:47 +0100 Subject: [PATCH] Feat/minio reader noverify (#10744) * allowing connection to a TLS-secured with untrusted certificate MinIO instance * updated README for MinIO reader * cert_check should default to True for MinIO reader --------- Co-authored-by: Ferdinando Simonetti --- .../readers/llama-index-readers-minio/llama_index/README.md | 5 ++++- .../llama_index/readers/minio/minio_client/base.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/llama-index-integrations/readers/llama-index-readers-minio/llama_index/README.md b/llama-index-integrations/readers/llama-index-readers-minio/llama_index/README.md index 35c3feeedb50a..e17e81f4d6bcc 100644 --- a/llama-index-integrations/readers/llama-index-readers-minio/llama_index/README.md +++ b/llama-index-integrations/readers/llama-index-readers-minio/llama_index/README.md @@ -37,6 +37,8 @@ To use this loader, you need to pass in the name of your Minio Bucket. After tha Otherwise, you may specify a prefix if you only want to parse certain files in the Bucket, or a subdirectory. +You can now use the client with a TLS-secured MinIO instance (`minio_secure=True`), even if server's certificate isn't trusted (`minio_cert_check=False`). + ```python from llama_index import download_loader @@ -44,7 +46,8 @@ MinioReader = download_loader("MinioReader") loader = MinioReader( bucket="documents", minio_endpoint="localhost:9000", - minio_secure=False, + minio_secure=True, + minio_cert_check=False, minio_access_key="minio_access_key", minio_secret_key="minio_secret_key", ) diff --git a/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/base.py b/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/base.py index 35ec79858f3ac..3c4db2ec95129 100644 --- a/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/base.py +++ b/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/base.py @@ -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 = True, minio_access_key: Optional[str] = None, minio_secret_key: Optional[str] = None, minio_session_token: Optional[str] = None, @@ -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) @@ -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 @@ -85,6 +89,7 @@ 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,