velxio/backend/app/core/config.py

34 lines
1.3 KiB
Python
Raw Normal View History

from pydantic_settings import BaseSettings
class Settings(BaseSettings):
chore(oss): drop dead auth/DB dependencies from OSS image After Phase 4 of the OSS / pro split, the OSS code base imports zero auth/DB modules (verified with grep across backend/app/). But the requirements.txt + config.py + .env.example + docs still listed SQLAlchemy, aiosqlite, JWT/bcrypt, OAuth, SECRET_KEY etc. as if they were live. Self-hosters running `pip install -r requirements.txt` were pulling ~30 MB of packages the code never imports. Changes: * backend/requirements.txt — drop sqlalchemy, greenlet, aiosqlite, python-jose, passlib[bcrypt], bcrypt, authlib, email-validator, python-multipart. Keep fastapi, uvicorn, websockets, pydantic, pydantic-settings, httpx, mcp, esptool, wasmtime — everything OSS actually uses. * backend/app/core/config.py — Settings reduced to FRONTEND_URL only. Comment explains the overlay path that adds the rest at Docker build time. * backend/.env.example — same trim: only FRONTEND_URL, with a comment explaining why this file is almost empty. * README.md — "Auth & Project Persistence" section rewritten to describe .vlx export/import. Env-var table reduced to a single row. Stack table updated: no SQLAlchemy, no JWT, persistence = .vlx files. * CLAUDE.md — intro line updated (Auth: None, persistence: .vlx). Key-file-locations rewritten to list the OSS-stateless backend + the new lib/proRoutes / proSession / proSaveAction seams, with an explicit "removed in the split" note pointing to velxio-prod. Stores section drops useAuthStore (overlay-only now). Backend gotchas drop the bcrypt + email-validator + model-import notes. Implemented-features list replaces "Auth + URL persistence + user profile" with portable .vlx export/import. * docs/ESP32_EMULATION.md — two `docker run` examples dropped the `-e SECRET_KEY=...` arg (no longer needed). OSS build verified end-to-end (285 SEO pages prerender, 20 stateless routes, zero sqlalchemy imports). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 03:06:27 +07:00
"""OSS settings — stateless deployment.
Auth, DB, OAuth, billing, mail relay etc. moved to the velxio-prod
private overlay during the Phase 1-4 OSS/pro split. The overlay
physically replaces this file at Docker build time with a richer
Settings class that ADDS those fields on top of FRONTEND_URL (see
pro/backend/app/core/config.py).
Adding a setting here means the stateless OSS image will read it.
If the new setting only makes sense with an auth/DB stack (e.g.
SMTP creds, third-party API keys for analytics), add it to the
overlay's config.py instead so the OSS image stays minimal.
"""
# CORS — used by main.py to whitelist the SPA origin during local dev
# and to build redirect URLs from auth routes in the overlay.
FRONTEND_URL: str = "http://localhost:5173"
# extra="ignore": tolerate legacy keys (DATA_DIR, SECRET_KEY, DATABASE_URL, …)
# left over from pre-split .env files or from the velxio-prod overlay so the
# OSS image starts cleanly instead of crashing with extra_forbidden.
model_config = {
"env_file": ".env",
"env_file_encoding": "utf-8",
"extra": "ignore",
}
settings = Settings()