Files
ProxyTrash/backend/app/core/config.py
2026-05-23 05:33:39 -06:00

26 lines
763 B
Python

from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file='.env', env_file_encoding='utf-8', extra='ignore')
database_url: str = 'postgresql+psycopg://postgres:password@127.0.0.1:5432/hackaton'
secret_key: str = 'change-this-in-production'
algorithm: str = 'HS256'
access_token_expire_minutes: int = 60 * 24 * 7
cors_origins: str = 'http://localhost:3000,http://10.0.2.2:3000'
@property
def cors_origin_list(self) -> list[str]:
return [origin.strip() for origin in self.cors_origins.split(',') if origin.strip()]
@lru_cache
def get_settings() -> Settings:
return Settings()
settings = get_settings()