Initial commit - cleaned repository
This commit is contained in:
54
services/images/backend/app/core/config.py
Normal file
54
services/images/backend/app/core/config.py
Normal file
@ -0,0 +1,54 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from pathlib import Path
|
||||
|
||||
class Settings(BaseSettings):
|
||||
# 기본 설정
|
||||
app_name: str = "Image Proxy Service"
|
||||
debug: bool = True
|
||||
|
||||
# 캐시 설정 (MinIO 전환 시에도 로컬 임시 파일용)
|
||||
cache_dir: Path = Path("/app/cache")
|
||||
max_cache_size_gb: int = 10
|
||||
cache_ttl_days: int = 30
|
||||
|
||||
# MinIO 설정
|
||||
use_minio: bool = True # MinIO 사용 여부
|
||||
minio_endpoint: str = "minio:9000"
|
||||
minio_access_key: str = "minioadmin"
|
||||
minio_secret_key: str = "minioadmin"
|
||||
minio_bucket_name: str = "image-cache"
|
||||
minio_secure: bool = False
|
||||
|
||||
# 이미지 설정
|
||||
max_image_size_mb: int = 20
|
||||
allowed_formats: list = ["jpg", "jpeg", "png", "gif", "webp", "svg"]
|
||||
|
||||
# 리사이징 설정 - 뉴스 카드 용도별 최적화
|
||||
thumbnail_sizes: dict = {
|
||||
"thumb": (150, 100), # 작은 썸네일 (3:2 비율)
|
||||
"card": (360, 240), # 뉴스 카드용 (3:2 비율)
|
||||
"list": (300, 200), # 리스트용 (3:2 비율)
|
||||
"detail": (800, 533), # 상세 페이지용 (원본 비율 유지)
|
||||
"hero": (1200, 800) # 히어로 이미지용 (원본 비율 유지)
|
||||
}
|
||||
|
||||
# 이미지 최적화 설정 - 품질 보장하면서 최저 용량
|
||||
jpeg_quality: int = 85 # JPEG 품질 (품질 향상)
|
||||
webp_quality: int = 85 # WebP 품질 (품질 향상으로 검정색 문제 해결)
|
||||
webp_lossless: bool = False # 무손실 압축 비활성화 (용량 최적화)
|
||||
png_compress_level: int = 9 # PNG 최대 압축 (0-9, 9가 최고 압축)
|
||||
convert_to_webp: bool = False # WebP 변환 임시 비활성화 (검정색 이미지 문제)
|
||||
|
||||
# 고급 최적화 설정
|
||||
progressive_jpeg: bool = True # 점진적 JPEG (로딩 성능 향상)
|
||||
strip_metadata: bool = True # EXIF 등 메타데이터 제거 (용량 절약)
|
||||
optimize_png: bool = True # PNG 팔레트 최적화
|
||||
|
||||
# 외부 요청 설정
|
||||
request_timeout: int = 30
|
||||
user_agent: str = "ImageProxyService/1.0"
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user