33 lines
770 B
Python
33 lines
770 B
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
extra="ignore",
|
|
case_sensitive=False,
|
|
)
|
|
|
|
# Database
|
|
database_url: str = "postgresql+asyncpg://sport_prog:secret@localhost:5432/sport_programming"
|
|
|
|
# JWT
|
|
secret_key: str = "your-super-secret-key-change-in-production"
|
|
algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 60 * 24 # 24 hours
|
|
|
|
# Piston (code execution engine)
|
|
piston_url: str = "http://localhost:2000"
|
|
|
|
# CORS
|
|
cors_origins: str = "http://localhost:3000"
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|
|
|
|
|
|
settings = get_settings()
|