from functools import lru_cache from pathlib import Path from typing import List import os from pydantic_settings import BaseSettings class Settings(BaseSettings): PROJECT_NAME: str = "Intelligent Planet Plan" VERSION: str = "1.0.0" API_V1_STR: str = "/api/v1" SECRET_KEY: str = "your-secret-key-change-in-production" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 0 REFRESH_TOKEN_EXPIRE_DAYS: int = 0 POSTGRES_SERVER: str = "localhost" POSTGRES_USER: str = "postgres" POSTGRES_PASSWORD: str = "postgres" POSTGRES_DB: str = "planet_db" DATABASE_URL: str = f"postgresql+asyncpg://postgres:postgres@localhost:5432/planet_db" REDIS_SERVER: str = "localhost" REDIS_PORT: int = 6379 REDIS_DB: int = 0 CORS_ORIGINS: List[str] = ["http://localhost:3000", "http://localhost:8000"] SPACETRACK_USERNAME: str = "" SPACETRACK_PASSWORD: str = "" @property def REDIS_URL(self) -> str: return os.getenv( "REDIS_URL", f"redis://{self.REDIS_SERVER}:{self.REDIS_PORT}/{self.REDIS_DB}" ) class Config: env_file = Path(__file__).parent.parent.parent / ".env" case_sensitive = True @lru_cache() def get_settings() -> Settings: return Settings() settings = get_settings()