Kenny Dizi Kevin Hu commited on
Commit
bc59ad5
·
1 Parent(s): becc54e

Use s3 configuration from settings module (#4167)

Browse files

### What problem does this PR solve?

Fix the issue when retrieving AWS credentials from the S3 configuration
from the settings module instead of getting from the environment
variables.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Kevin Hu <[email protected]>

Files changed (1) hide show
  1. rag/utils/s3_conn.py +6 -4
rag/utils/s3_conn.py CHANGED
@@ -6,15 +6,17 @@ from botocore.client import Config
6
  import time
7
  from io import BytesIO
8
  from rag.utils import singleton
 
9
 
10
  @singleton
11
  class RAGFlowS3(object):
12
  def __init__(self):
13
  self.conn = None
14
- self.endpoint = os.getenv('ENDPOINT', None)
15
- self.access_key = os.getenv('ACCESS_KEY', None)
16
- self.secret_key = os.getenv('SECRET_KEY', None)
17
- self.region = os.getenv('REGION', None)
 
18
  self.__open__()
19
 
20
  def __open__(self):
 
6
  import time
7
  from io import BytesIO
8
  from rag.utils import singleton
9
+ from rag import settings
10
 
11
  @singleton
12
  class RAGFlowS3(object):
13
  def __init__(self):
14
  self.conn = None
15
+ self.s3_config = settings.S3
16
+ self.endpoint = self.s3_config.get('endpoint', None)
17
+ self.access_key = self.s3_config.get('access_key', None)
18
+ self.secret_key = self.s3_config.get('secret_key', None)
19
+ self.region = self.s3_config.get('region', None)
20
  self.__open__()
21
 
22
  def __open__(self):