Skip to content

Commit

Permalink
Use s3 configuration from settings module (infiniflow#4167)
Browse files Browse the repository at this point in the history
### 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 <kevinhu.sh@gmail.com>
  • Loading branch information
2 people authored and baifachuan committed Dec 26, 2024
1 parent 2ca6180 commit b825ba3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rag/utils/s3_conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
import time
from io import BytesIO
from rag.utils import singleton
from rag import settings

@singleton
class RAGFlowS3(object):
def __init__(self):
self.conn = None
self.endpoint = os.getenv('ENDPOINT', None)
self.access_key = os.getenv('ACCESS_KEY', None)
self.secret_key = os.getenv('SECRET_KEY', None)
self.region = os.getenv('REGION', None)
self.s3_config = settings.S3
self.endpoint = self.s3_config.get('endpoint', None)
self.access_key = self.s3_config.get('access_key', None)
self.secret_key = self.s3_config.get('secret_key', None)
self.region = self.s3_config.get('region', None)
self.__open__()

def __open__(self):
Expand Down

0 comments on commit b825ba3

Please sign in to comment.