refactor: use dify_config to replace legacy usage of flask app's config (#9089)
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
from collections.abc import Generator
|
||||
|
||||
from flask import Flask
|
||||
from qcloud_cos import CosConfig, CosS3Client
|
||||
|
||||
from configs import dify_config
|
||||
from extensions.storage.base_storage import BaseStorage
|
||||
|
||||
|
||||
class TencentCosStorage(BaseStorage):
|
||||
"""Implementation for Tencent Cloud COS storage."""
|
||||
|
||||
def __init__(self, app: Flask):
|
||||
super().__init__(app)
|
||||
app_config = self.app.config
|
||||
self.bucket_name = app_config.get("TENCENT_COS_BUCKET_NAME")
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.bucket_name = dify_config.TENCENT_COS_BUCKET_NAME
|
||||
config = CosConfig(
|
||||
Region=app_config.get("TENCENT_COS_REGION"),
|
||||
SecretId=app_config.get("TENCENT_COS_SECRET_ID"),
|
||||
SecretKey=app_config.get("TENCENT_COS_SECRET_KEY"),
|
||||
Scheme=app_config.get("TENCENT_COS_SCHEME"),
|
||||
Region=dify_config.TENCENT_COS_REGION,
|
||||
SecretId=dify_config.TENCENT_COS_SECRET_ID,
|
||||
SecretKey=dify_config.TENCENT_COS_SECRET_KEY,
|
||||
Scheme=dify_config.TENCENT_COS_SCHEME,
|
||||
)
|
||||
self.client = CosS3Client(config)
|
||||
|
||||
|
Reference in New Issue
Block a user