Browse Source

Use s3 configuration from settings module (#4167)

### 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>
tags/v0.15.1
Kenny Dizi 10 months ago
parent
commit
f13f503952
No account linked to committer's email address
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      rag/utils/s3_conn.py

+ 6
- 4
rag/utils/s3_conn.py View File

@@ -6,15 +6,17 @@ from botocore.client import Config
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):

Loading…
Cancel
Save