copied the code from the working repo
This commit is contained in:
21
mtucijobsbackend/app/storage.py
Normal file
21
mtucijobsbackend/app/storage.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from minio import Minio
|
||||
from minio.error import S3Error
|
||||
from .config import settings
|
||||
|
||||
def get_client():
|
||||
try:
|
||||
client = Minio(
|
||||
endpoint=settings.endpoint,
|
||||
secure=False,
|
||||
access_key=settings.access_key,
|
||||
secret_key=settings.secret_key
|
||||
)
|
||||
|
||||
found = client.bucket_exists("tgjobs")
|
||||
|
||||
if not found:
|
||||
client.make_bucket("tgjobs")
|
||||
|
||||
return client
|
||||
except S3Error as exc:
|
||||
print("error occurred.", exc)
|
||||
Reference in New Issue
Block a user