-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract storage provider configs into dify configs (#5443)
- Loading branch information
1 parent
8890978
commit b05cc3a
Showing
7 changed files
with
178 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
api/configs/middleware/storage/aliyun_oss_storage_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class AliyunOSSStorageConfig(BaseModel): | ||
""" | ||
Aliyun storage configs | ||
""" | ||
|
||
ALIYUN_OSS_BUCKET_NAME: Optional[str] = Field( | ||
description='Aliyun storage ', | ||
default=None, | ||
) | ||
|
||
ALIYUN_OSS_ACCESS_KEY: Optional[str] = Field( | ||
description='Aliyun storage access key', | ||
default=None, | ||
) | ||
|
||
ALIYUN_OSS_SECRET_KEY: Optional[str] = Field( | ||
description='Aliyun storage secret key', | ||
default=None, | ||
) | ||
|
||
ALIYUN_OSS_ENDPOINT: Optional[str] = Field( | ||
description='Aliyun storage endpoint URL', | ||
default=None, | ||
) | ||
|
||
ALIYUN_OSS_REGION: Optional[str] = Field( | ||
description='Aliyun storage region', | ||
default=None, | ||
) | ||
|
||
ALIYUN_OSS_AUTH_VERSION: Optional[str] = Field( | ||
description='Aliyun storage authentication version', | ||
default=None, | ||
) |
44 changes: 44 additions & 0 deletions
44
api/configs/middleware/storage/amazon_s3_storage_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class S3StorageConfig(BaseModel): | ||
""" | ||
S3 storage configs | ||
""" | ||
|
||
S3_ENDPOINT: Optional[str] = Field( | ||
description='S3 storage endpoint', | ||
default=None, | ||
) | ||
|
||
S3_REGION: Optional[str] = Field( | ||
description='S3 storage region', | ||
default=None, | ||
) | ||
|
||
S3_BUCKET_NAME: Optional[str] = Field( | ||
description='S3 storage bucket name', | ||
default=None, | ||
) | ||
|
||
S3_ACCESS_KEY: Optional[str] = Field( | ||
description='S3 storage access key', | ||
default=None, | ||
) | ||
|
||
S3_SECRET_KEY: Optional[str] = Field( | ||
description='S3 storage secret key', | ||
default=None, | ||
) | ||
|
||
S3_ADDRESS_STYLE: str = Field( | ||
description='S3 storage address style', | ||
default='auto', | ||
) | ||
|
||
S3_USE_AWS_MANAGED_IAM: bool = Field( | ||
description='whether to use aws managed IAM for S3', | ||
default=False, | ||
) |
29 changes: 29 additions & 0 deletions
29
api/configs/middleware/storage/azure_blob_storage_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class AzureBlobStorageConfig(BaseModel): | ||
""" | ||
Azure Blob storage configs | ||
""" | ||
|
||
AZURE_BLOB_ACCOUNT_NAME: Optional[str] = Field( | ||
description='Azure Blob account name', | ||
default=None, | ||
) | ||
|
||
AZURE_BLOB_ACCOUNT_KEY: Optional[str] = Field( | ||
description='Azure Blob account key', | ||
default=None, | ||
) | ||
|
||
AZURE_BLOB_CONTAINER_NAME: Optional[str] = Field( | ||
description='Azure Blob container name', | ||
default=None, | ||
) | ||
|
||
AZURE_BLOB_ACCOUNT_URL: Optional[str] = Field( | ||
description='Azure Blob account url', | ||
default=None, | ||
) |
19 changes: 19 additions & 0 deletions
19
api/configs/middleware/storage/google_cloud_storage_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class GoogleCloudStorageConfig(BaseModel): | ||
""" | ||
Google Cloud storage configs | ||
""" | ||
|
||
GOOGLE_STORAGE_BUCKET_NAME: Optional[str] = Field( | ||
description='Google Cloud storage bucket name', | ||
default=None, | ||
) | ||
|
||
GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: Optional[str] = Field( | ||
description='Google Cloud storage service account json base64', | ||
default=None, | ||
) |
34 changes: 34 additions & 0 deletions
34
api/configs/middleware/storage/tencent_cos_storage_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class TencentCloudCOSStorageConfig(BaseModel): | ||
""" | ||
Tencent Cloud COS storage configs | ||
""" | ||
|
||
TENCENT_COS_BUCKET_NAME: Optional[str] = Field( | ||
description='Tencent Cloud COS bucket name', | ||
default=None, | ||
) | ||
|
||
TENCENT_COS_REGION: Optional[str] = Field( | ||
description='Tencent Cloud COS region', | ||
default=None, | ||
) | ||
|
||
TENCENT_COS_SECRET_ID: Optional[str] = Field( | ||
description='Tencent Cloud COS secret id', | ||
default=None, | ||
) | ||
|
||
TENCENT_COS_SECRET_KEY: Optional[str] = Field( | ||
description='Tencent Cloud COS secret key', | ||
default=None, | ||
) | ||
|
||
TENCENT_COS_SCHEME: Optional[str] = Field( | ||
description='Tencent Cloud COS scheme', | ||
default=None, | ||
) |