solorpower_server/app/core/config.py

34 lines
705 B
Python

"""
환경변수 설정 모듈
- python-dotenv를 사용하여 .env 파일에서 환경변수 로드
"""
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
"""애플리케이션 설정"""
# Supabase 설정
SUPABASE_URL: str
SUPABASE_KEY: str
# 앱 설정
APP_NAME: str = "Solar Power Monitoring API"
APP_VERSION: str = "1.0.0"
DEBUG: bool = False
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
@lru_cache()
def get_settings() -> Settings:
"""
설정 싱글톤 인스턴스 반환
lru_cache를 사용하여 한 번만 로드
"""
return Settings()