@@ -44,17 +44,19 @@ class MinioAdaptor:
44
44
# uses blocking http requests, so we can't use asyncio to interleave them.
45
45
_download_executor = ThreadPoolExecutor (max_workers = 5 )
46
46
47
- def __init__ (self , mino_endpoint : str ,
47
+ def __init__ (self , minio_endpoint : str ,
48
+ secured : bool = False ,
48
49
access_key : str = 'miniouser' ,
49
50
secretkey : str = 'leftfoot1' ):
50
- self ._endpoint = mino_endpoint
51
+ self ._endpoint = minio_endpoint
52
+ self ._secured = secured
51
53
self ._access_key = access_key
52
54
self ._secretkey = secretkey
53
55
54
56
self ._client = Minio (self ._endpoint ,
55
57
access_key = self ._access_key ,
56
58
secret_key = self ._secretkey ,
57
- secure = False )
59
+ secure = self . _secured )
58
60
59
61
@on_exception (backoff .constant , ResponseError , interval = 0.1 )
60
62
def get_files (self , request_id ):
@@ -118,7 +120,7 @@ def __init__(self, c: Optional[ConfigView] = None,
118
120
if self ._always is None and c is not None :
119
121
self ._config_adaptor = self ._from_config (c )
120
122
121
- def from_best (self , transation_info : Optional [Dict [str , str ]] = None ) -> MinioAdaptor :
123
+ def from_best (self , transaction_info : Optional [Dict [str , str ]] = None ) -> MinioAdaptor :
122
124
'''Using the information we have, create the proper Minio Adaptor with the correct
123
125
endpoint and login information. Order of adaptor generation:
124
126
@@ -136,14 +138,14 @@ def from_best(self, transation_info: Optional[Dict[str, str]] = None) -> MinioAd
136
138
if self ._always is not None :
137
139
logging .getLogger (__name__ ).debug ('Using the pre-defined minio_adaptor' )
138
140
return self ._always
139
- if transation_info is not None :
140
- if 'minio-endpoint' in transation_info \
141
- and 'minio-access-key' in transation_info \
142
- and 'minio-secret-key' in transation_info :
141
+ if transaction_info is not None :
142
+ keys = ['minio-endpoint' , 'minio-secured' , 'minio-access-key' , 'minio-secret-key' ]
143
+ if all (k in transaction_info for k in keys ):
143
144
logging .getLogger (__name__ ).debug ('Using the request-specific minio_adaptor' )
144
- return MinioAdaptor (transation_info ['minio-endpoint' ],
145
- transation_info ['minio-access-key' ],
146
- transation_info ['minio-secret-key' ])
145
+ return MinioAdaptor (transaction_info ['minio-endpoint' ],
146
+ transaction_info ['minio-secured' ],
147
+ transaction_info ['minio-access-key' ],
148
+ transaction_info ['minio-secret-key' ])
147
149
if self ._config_adaptor is not None :
148
150
logging .getLogger (__name__ ).debug ('Using the config-file minio_adaptor' )
149
151
return self ._config_adaptor
0 commit comments