mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-11 08:16:03 +00:00
Add S3 object storage protocol support (#1780)
* Initial plan * Add S3 object storage support with provider selection Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * Fix lint issue: remove unused MagicMock import Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>
This commit is contained in:
@@ -3,11 +3,11 @@ from __future__ import annotations
|
||||
|
||||
from ..core import app
|
||||
from . import provider
|
||||
from .providers import localstorage
|
||||
from .providers import localstorage, s3storage
|
||||
|
||||
|
||||
class StorageMgr:
|
||||
"""存储管理器"""
|
||||
"""Storage manager"""
|
||||
|
||||
ap: app.Application
|
||||
|
||||
@@ -15,7 +15,16 @@ class StorageMgr:
|
||||
|
||||
def __init__(self, ap: app.Application):
|
||||
self.ap = ap
|
||||
self.storage_provider = localstorage.LocalStorageProvider(ap)
|
||||
|
||||
async def initialize(self):
|
||||
storage_config = self.ap.instance_config.data.get('storage', {})
|
||||
storage_type = storage_config.get('use', 'local')
|
||||
|
||||
if storage_type == 's3':
|
||||
self.storage_provider = s3storage.S3StorageProvider(self.ap)
|
||||
self.ap.logger.info('Initialized S3 storage backend.')
|
||||
else:
|
||||
self.storage_provider = localstorage.LocalStorageProvider(self.ap)
|
||||
self.ap.logger.info('Initialized local storage backend.')
|
||||
|
||||
await self.storage_provider.initialize()
|
||||
|
||||
Reference in New Issue
Block a user