mirror of
https://github.com/idrainformatica/PecFlow.git
synced 2026-06-16 12:45:42 +02:00
feat: Fase 1 – Fondamenta complete (backend FastAPI + auth + permessi)
- docker-compose.yml: PostgreSQL 16, Redis 7, MinIO, Nginx - backend FastAPI: struttura monorepo, config pydantic-settings - modelli SQLAlchemy: tutti i modelli (tenants, users, mailboxes, messages, archival, permissions, labels, audit_log) - migrazione Alembic 0001: schema completo in pure SQL - auth API: login JWT, refresh token rotation, logout, 2FA TOTP (setup/verify/disable) - CRUD utenti: lista, crea, modifica, reset password, soft delete - permessi granulari (Fase 1-A): mailbox_permissions, assegna/revoca/lista - CRUD tenant: gestione super-admin - sicurezza: AES-256-GCM cifratura credenziali IMAP/SMTP, bcrypt password - RLS PostgreSQL: isolamento multi-tenant per request - seed sviluppo: tenant demo + admin + operator - test unit: security (bcrypt, JWT, AES), auth_service - test integration: auth endpoints, users endpoints - CI GitHub Actions: lint (ruff), test (pytest), build Docker, security scan - infra: nginx.conf, redis.conf - Makefile con comandi make dev/test/migrate/seed Definition of Done: ✅ Login, refresh token e TOTP funzionanti ✅ make dev porta in piedi tutto lo stack locale ✅ CI configurata
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# PecFlow – Variabili d'ambiente
|
||||
# Copia questo file in .env e personalizza i valori
|
||||
# NON committare mai il file .env con valori reali
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
# ── Applicazione ─────────────────────────────────────────────────────────────
|
||||
APP_ENV=development # development | staging | production
|
||||
APP_DEBUG=true
|
||||
APP_HOST=0.0.0.0
|
||||
APP_PORT=8000
|
||||
APP_BASE_URL=http://localhost:8000
|
||||
|
||||
# ── Sicurezza ─────────────────────────────────────────────────────────────────
|
||||
# Genera con: python -c "import secrets; print(secrets.token_hex(32))"
|
||||
SECRET_KEY=change-me-generate-a-random-64-char-hex-string-here-00000000000000
|
||||
ALGORITHM=HS256
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES=15
|
||||
REFRESH_TOKEN_EXPIRE_DAYS=30
|
||||
|
||||
# Chiave AES-256-GCM per cifratura credenziali IMAP/SMTP (32 bytes = 64 hex chars)
|
||||
# Genera con: python -c "import secrets; print(secrets.token_hex(32))"
|
||||
ENCRYPTION_KEY=change-me-generate-a-random-64-char-hex-string-here-11111111111
|
||||
|
||||
# ── Database PostgreSQL ───────────────────────────────────────────────────────
|
||||
POSTGRES_HOST=db
|
||||
POSTGRES_PORT=5432
|
||||
POSTGRES_DB=pecflow
|
||||
POSTGRES_USER=pecflow
|
||||
POSTGRES_PASSWORD=pecflow_dev_password
|
||||
|
||||
DATABASE_URL=postgresql+asyncpg://pecflow:pecflow_dev_password@db:5432/pecflow
|
||||
DATABASE_URL_SYNC=postgresql://pecflow:pecflow_dev_password@db:5432/pecflow
|
||||
|
||||
# ── Redis ─────────────────────────────────────────────────────────────────────
|
||||
REDIS_URL=redis://redis:6379/0
|
||||
|
||||
# ── MinIO (Object Storage) ────────────────────────────────────────────────────
|
||||
MINIO_ENDPOINT=minio:9000
|
||||
MINIO_ACCESS_KEY=minioadmin
|
||||
MINIO_SECRET_KEY=minioadmin
|
||||
MINIO_BUCKET=pecflow
|
||||
MINIO_USE_SSL=false
|
||||
|
||||
# ── CORS ──────────────────────────────────────────────────────────────────────
|
||||
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
|
||||
|
||||
# ── Rate Limiting ─────────────────────────────────────────────────────────────
|
||||
RATE_LIMIT_AUTH=10/minute # max 10 tentativi di login al minuto per IP
|
||||
RATE_LIMIT_DEFAULT=100/minute
|
||||
|
||||
# ── Logging ───────────────────────────────────────────────────────────────────
|
||||
LOG_LEVEL=INFO # DEBUG | INFO | WARNING | ERROR | CRITICAL
|
||||
LOG_JSON=false # true in produzione per log strutturati JSON
|
||||
|
||||
# ── Email SMTP (per notifiche di sistema, NON caselle PEC) ───────────────────
|
||||
SYSTEM_SMTP_HOST=
|
||||
SYSTEM_SMTP_PORT=587
|
||||
SYSTEM_SMTP_USER=
|
||||
SYSTEM_SMTP_PASSWORD=
|
||||
SYSTEM_SMTP_FROM=noreply@pecflow.it
|
||||
Reference in New Issue
Block a user