moved to shared folder
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
"""Definition of connect function."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
from minio import Minio
|
||||
|
||||
|
||||
def connect(
|
||||
) -> Minio:
|
||||
"""Connect to MinIO server"""
|
||||
minio_endpoint = os.getenv('MINIO_ENDPOINT', default=None)
|
||||
assert isinstance(minio_endpoint, str)
|
||||
minio_access_key = os.getenv('MINIO_ACCESS_KEY', default=None)
|
||||
assert isinstance(minio_access_key, str)
|
||||
minio_secret_key = os.getenv('MINIO_SECRET_KEY', default=None)
|
||||
assert isinstance(minio_secret_key, str)
|
||||
minio_bucket_name = os.getenv('MINIO_BUCKET_NAME', default=None)
|
||||
assert isinstance(minio_bucket_name, str)
|
||||
# connect client
|
||||
client = Minio(
|
||||
endpoint=minio_endpoint,
|
||||
access_key=minio_access_key,
|
||||
secret_key=minio_secret_key,
|
||||
secure=False,
|
||||
)
|
||||
# ensure bucket exists
|
||||
if not client.bucket_exists(bucket_name=minio_bucket_name):
|
||||
client.make_bucket(bucket_name=minio_bucket_name)
|
||||
return client
|
||||
Reference in New Issue
Block a user