Skip to content

Commit

Permalink
Feat/minio reader noverify (#10744)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
ferdinandosimonetti and Ferdinando Simonetti authored Feb 15, 2024
1 parent 036ff28 commit b06c888
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ 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

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",
)
Expand Down
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 = True,
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,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,
Expand Down

0 comments on commit b06c888

Please sign in to comment.