瀏覽代碼

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 月之前
父節點
當前提交
f13f503952
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 6 行新增4 行删除
  1. 6
    4
      rag/utils/s3_conn.py

+ 6
- 4
rag/utils/s3_conn.py 查看文件

import time import time
from io import BytesIO from io import BytesIO
from rag.utils import singleton from rag.utils import singleton
from rag import settings


@singleton @singleton
class RAGFlowS3(object): class RAGFlowS3(object):
def __init__(self): def __init__(self):
self.conn = None 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__() self.__open__()


def __open__(self): def __open__(self):

Loading…
取消
儲存