be0c8bceb6
- Volume data/ (bind mount ./data) remplace le volume uploads nommé
data/notes/ → .md auto-générés, data/uploads/ → médias, data/backup/ → dumps
- Service Redis (redis:7-alpine) + worker ARQ (backend-worker)
- notes_markdown.py : frontmatter YAML + contenu + pièces jointes (liens relatifs)
Nom : YYYY-MM-DD_slug-titre_shortid.md, rotation si titre modifié
- api/notes.py : publie export_note_markdown / remove_note_markdown sur Redis
après chaque create / update / delete / add_attachment / delete_attachment
- api/admin.py : POST /backup, GET /backups, POST /restore/{filename} (pg_dump/pg_restore)
- Backend Dockerfile : postgresql-client ; requirements : arq==0.26.1
- ConfigPage : section "Base de données" avec sauvegarde + liste + restauration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
875 B
Python
32 lines
875 B
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
from pathlib import Path
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
|
|
|
|
database_url: str = "postgresql+asyncpg://homehub:homehub@localhost:5432/homehub"
|
|
upload_dir: str = "/data/uploads"
|
|
data_dir: str = "/data"
|
|
redis_url: str = "redis://redis:6379"
|
|
cors_origins: str = "http://localhost:3000"
|
|
|
|
@property
|
|
def cors_origins_list(self) -> list[str]:
|
|
return [o.strip() for o in self.cors_origins.split(",")]
|
|
|
|
@property
|
|
def upload_path(self) -> Path:
|
|
return Path(self.upload_dir)
|
|
|
|
@property
|
|
def notes_md_path(self) -> Path:
|
|
return Path(self.data_dir) / "notes"
|
|
|
|
@property
|
|
def backup_path(self) -> Path:
|
|
return Path(self.data_dir) / "backup"
|
|
|
|
|
|
settings = Settings()
|