Spaces:
Sleeping
Sleeping
File size: 1,136 Bytes
e656014 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import Literal
class Settings(BaseSettings):
"""Application configuration loaded from environment variables."""
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=False,
)
# Database
database_url: str # postgresql+asyncpg://user:pass@host/db
# JWT
jwt_secret: str
jwt_algorithm: str = "HS256"
jwt_expiry_hours: int = 24
# Encryption (for product keys)
encryption_key: str
# Payments
crypto_processor: Literal["mock", "coinbase", "nowpayments"] = "mock"
crypto_api_key: str = ""
crypto_webhook_secret: str = ""
# App
app_env: Literal["development", "staging", "production"] = "development"
debug: bool = True
allowed_origins: str = "http://localhost:3000"
@property
def cors_origins(self) -> list[str]:
"""Parse comma-separated ALLOWED_ORIGINS into a list."""
return [o.strip() for o in self.allowed_origins.split(",")]
settings = Settings()
|