mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-03 18:36:21 +00:00
fix s3 init config . (#8886)
### What problem does this PR solve? when``` if 'signature_version' in self.s3_config:``` and ```if 'addressing_style' in self.s3_config:``` both true. the config init is error, will be overwrite by last one. this pr is for fix that case. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Signed-off-by: zhanluxianshen <zhanluxianshen@163.com>
This commit is contained in:
parent
c0de0f3a60
commit
fd97ce3e5a
@ -66,6 +66,7 @@ class RAGFlowS3:
|
||||
|
||||
try:
|
||||
s3_params = {}
|
||||
config_kwargs = {}
|
||||
# if not set ak/sk, boto3 s3 client would try several ways to do the authentication
|
||||
# see doc: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials
|
||||
if self.access_key and self.secret_key:
|
||||
@ -78,9 +79,12 @@ class RAGFlowS3:
|
||||
if 'endpoint_url' in self.s3_config:
|
||||
s3_params['endpoint_url'] = self.endpoint_url
|
||||
if 'signature_version' in self.s3_config:
|
||||
s3_params['config'] = Config(s3={"signature_version": self.signature_version})
|
||||
config_kwargs['signature_version'] = self.signature_version
|
||||
if 'addressing_style' in self.s3_config:
|
||||
s3_params['config'] = Config(s3={"addressing_style": self.addressing_style})
|
||||
config_kwargs['addressing_style'] = self.addressing_style
|
||||
if config_kwargs:
|
||||
s3_params['config'] = Config(**config_kwargs)
|
||||
|
||||
self.conn = boto3.client('s3', **s3_params)
|
||||
except Exception:
|
||||
logging.exception(f"Fail to connect at region {self.region} or endpoint {self.endpoint_url}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user