mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-07 14:26:03 +00:00
- Included botocore>=1.42.39 in dependencies to ensure compatibility with boto3. - Updated lock file to reflect the new botocore dependency.
33 lines
902 B
Python
33 lines
902 B
Python
from __future__ import annotations
|
|
|
|
|
|
from ..core import app
|
|
from . import provider
|
|
from .providers import localstorage
|
|
|
|
|
|
class StorageMgr:
|
|
"""Storage manager"""
|
|
|
|
ap: app.Application
|
|
|
|
storage_provider: provider.StorageProvider
|
|
|
|
def __init__(self, ap: app.Application):
|
|
self.ap = 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':
|
|
from .providers import s3storage
|
|
|
|
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()
|