Implements Better Abstraction on Top of StorageService and File Handlers
Adds Expiration Time to Config Reformats Project
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
from resize_image_service.config.config_s3 import get_config_s3
|
||||
from resize_image_service.service.s3_service import S3Service
|
||||
from resize_image_service.service.amazon_s3_service import AmazonS3Service
|
||||
from resize_image_service.service.storage_service import StorageService
|
||||
from resize_image_service.utils.enums.storage_type import StorageType
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
import os
|
||||
from functools import cache
|
||||
|
||||
|
||||
@cache
|
||||
def dependency_s3_service() -> S3Service:
|
||||
return S3Service(**get_config_s3())
|
||||
def dependency_storage_service() -> StorageService:
|
||||
load_dotenv()
|
||||
|
||||
if StorageType(os.environ["STORAGE_TYPE"]) == StorageType.S3_STORAGE:
|
||||
return AmazonS3Service(**get_config_s3())
|
||||
|
||||
raise RuntimeError("Invalid Storage Type")
|
||||
|
||||
Reference in New Issue
Block a user