feat(config): add database configuration layer with backend detection

Add AppConfig loaded from .env via dotenvy. DATABASE_URL prefix
determines the backend (sqlite:// → SQLite, postgresql:// → PostgreSQL).
ConfigError via thiserror gives clear messages on missing or unknown URLs.
Server logs the chosen backend at startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 19:44:55 +02:00
parent 18134d6f4b
commit b6d1e22d25
7 changed files with 141 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ ssr = [
"dep:tower-http",
"dep:leptos_axum",
"dep:tracing-subscriber",
"dep:dotenvy",
"leptos/ssr",
"leptos_meta/ssr",
"leptos_router/ssr",
@@ -59,6 +60,8 @@ leptos_axum = { version = "0.7", optional = true }
tower-http = { version = "0.5", features = ["fs"], optional = true }
# Formateur de logs pour le terminal (affiche les messages tracing::info!...)
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }
# Charge automatiquement le fichier .env au démarrage du serveur
dotenvy = { version = "0.15", optional = true }
# --- Dépendances client uniquement (activées par la feature "hydrate") ---