Services: - api: FastAPI gateway with JWT auth, async endpoints, WebSocket - worker-gpu: CUDA sentence-transformers, FAISS IVFFlat, Ollama LLM - worker-indexer: Winnowing+MinHash plagiarism detection, PDF/DOCX extraction - worker-notifier: SMTP email notifications - worker-gost: GOST 7.1-2003 and GOST R 7.0.5-2008 formatting Infrastructure: - docker-compose.yml (production) + docker-compose.dev.yml (hot reload) - Nginx reverse proxy + WebSocket support - PostgreSQL 16 with Alembic migrations - Elasticsearch 8 with Russian/English analyzers - MinIO, RabbitMQ, Redis, Ollama Frontend: - React 18 + Vite + TypeScript + TailwindCSS + Zustand + React Query v5 - 9 pages: Home, Search, Cabinet, Task, Check, Bibliography, Pricing, Login, Register Scripts: - Parser stubs: OpenAlex, КиберЛенинка, arXiv (Phase 0 - to be filled) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
2.4 KiB
Python
83 lines
2.4 KiB
Python
"""Конфигурация приложения через Pydantic Settings."""
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Настройки приложения, читаемые из переменных окружения."""
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
case_sensitive=False,
|
|
)
|
|
|
|
# PostgreSQL
|
|
POSTGRES_HOST: str = "postgres"
|
|
POSTGRES_PORT: int = 5432
|
|
POSTGRES_DB: str = "antiplagiator"
|
|
POSTGRES_USER: str = "antiplagiator"
|
|
POSTGRES_PASSWORD: str = "changeme"
|
|
|
|
# Redis
|
|
REDIS_URL: str = "redis://redis:6379/0"
|
|
|
|
# RabbitMQ
|
|
RABBITMQ_URL: str = "amqp://guest:guest@rabbitmq:5672/"
|
|
|
|
# MinIO
|
|
MINIO_ENDPOINT: str = "minio:9000"
|
|
MINIO_ACCESS_KEY: str = "minioadmin"
|
|
MINIO_SECRET_KEY: str = "changeme"
|
|
MINIO_BUCKET_DOCS: str = "documents"
|
|
MINIO_BUCKET_BACKUPS: str = "backups"
|
|
|
|
# Elasticsearch
|
|
ELASTICSEARCH_URL: str = "http://elasticsearch:9200"
|
|
|
|
# Ollama
|
|
OLLAMA_URL: str = "http://ollama:11434"
|
|
|
|
# JWT
|
|
SECRET_KEY: str = "change-me-in-production-use-openssl-rand-hex-32"
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 10080 # 7 дней
|
|
|
|
# SMTP
|
|
SMTP_HOST: str = "smtp.yandex.ru"
|
|
SMTP_PORT: int = 465
|
|
SMTP_USER: str = "noreply@jze9.ru"
|
|
SMTP_PASSWORD: str = "changeme"
|
|
SMTP_FROM: str = "noreply@jze9.ru"
|
|
|
|
# App
|
|
APP_URL: str = "https://academic.jze9.ru"
|
|
ENVIRONMENT: str = "development"
|
|
DEBUG: bool = False
|
|
|
|
# CORS
|
|
CORS_ORIGINS: list[str] = [
|
|
"http://localhost:5173",
|
|
"http://localhost:3000",
|
|
"https://academic.jze9.ru",
|
|
]
|
|
|
|
@property
|
|
def database_url(self) -> str:
|
|
"""URL для asyncpg (асинхронные запросы)."""
|
|
return (
|
|
f"postgresql+asyncpg://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
|
|
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
|
)
|
|
|
|
@property
|
|
def database_url_sync(self) -> str:
|
|
"""URL для psycopg2 (Alembic и синхронные операции)."""
|
|
return (
|
|
f"postgresql+psycopg2://{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}"
|
|
f"@{self.POSTGRES_HOST}:{self.POSTGRES_PORT}/{self.POSTGRES_DB}"
|
|
)
|
|
|
|
|
|
settings = Settings()
|