- Integrated image-service from site00 as second microservice - Maintained proxy and caching functionality - Added Images service to docker-compose - Configured Console API Gateway routing to Images - Updated environment variables in .env - Successfully tested image proxy endpoints Services now running: - Console (API Gateway) - Users Service - Images Service (proxy & cache) - MongoDB & Redis Next: Kafka event system implementation 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
46 lines
1.8 KiB
Python
46 lines
1.8 KiB
Python
from pydantic_settings import BaseSettings
|
|
from pathlib import Path
|
|
|
|
class Settings(BaseSettings):
|
|
# 기본 설정
|
|
app_name: str = "Image Proxy Service"
|
|
debug: bool = True
|
|
|
|
# 캐시 설정
|
|
cache_dir: Path = Path("/app/cache")
|
|
max_cache_size_gb: int = 10
|
|
cache_ttl_days: int = 30
|
|
|
|
# 이미지 설정
|
|
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() |