Archived
- add uv configuration for the backend - update frontend to make auth work - add new auth endpoints - add bookmars feat - add reader feat
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings via pydantic-settings. Reads from env vars and .env."""
|
|
|
|
# Django
|
|
DJANGO_SECRET_KEY: str = "django-insecure-change-me-in-production"
|
|
DJANGO_DEBUG: bool = False
|
|
DJANGO_ALLOWED_HOSTS: list[str] = ["*"]
|
|
|
|
# PostgreSQL
|
|
DB_NAME: str = "cloud_reader"
|
|
DB_USER: str = "postgres"
|
|
DB_PASSWORD: str = "postgres"
|
|
DB_HOST: str = "localhost"
|
|
DB_PORT: int = 5432
|
|
|
|
# JWT
|
|
JWT_ACCESS_TOKEN_LIFETIME_MINUTES: int = 60
|
|
JWT_REFRESH_TOKEN_LIFETIME_DAYS: int = 7
|
|
|
|
# CORS
|
|
CORS_ALLOWED_ORIGINS: list[str] = [
|
|
"http://localhost:5173",
|
|
"http://localhost:3000",
|
|
]
|
|
|
|
# Open Library metadata enrichment
|
|
OPENLIBRARY_ENABLED: bool = True
|
|
OPENLIBRARY_PREFERRED_LANG: str = "es"
|
|
OPENLIBRARY_FALLBACK_LANG: str = "en"
|
|
OPENLIBRARY_TIMEOUT_SECONDS: float = 10.0
|
|
OPENLIBRARY_CONNECT_TIMEOUT_SECONDS: float = 15.0
|
|
OPENLIBRARY_USER_AGENT: str = "CloudReader/1.0 (https://github.com/cloud-reader)"
|
|
|
|
@property
|
|
def DATABASE_URL(self) -> str:
|
|
return (
|
|
f"postgresql://{self.DB_USER}:{self.DB_PASSWORD}"
|
|
f"@{self.DB_HOST}:{self.DB_PORT}/{self.DB_NAME}"
|
|
)
|
|
|
|
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
|
|
|
|
|
|
settings = Settings()
|