generated from gilles/template-webapp
import ali
This commit is contained in:
@@ -5,6 +5,7 @@ Documentation : https://docs.pydantic.dev/latest/concepts/pydantic_settings/
|
||||
"""
|
||||
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import Field, field_validator
|
||||
@@ -72,7 +73,10 @@ class Settings(BaseSettings):
|
||||
return [origin.strip() for origin in self.CORS_ORIGINS.split(",")]
|
||||
|
||||
# === Stockage fichiers ===
|
||||
UPLOAD_DIR: str = Field(default="./uploads", description="Répertoire des uploads")
|
||||
UPLOAD_DIR: str = Field(
|
||||
default="./uploads",
|
||||
description="Répertoire des uploads",
|
||||
)
|
||||
MAX_UPLOAD_SIZE_MB: int = Field(
|
||||
default=50, description="Taille max des uploads en Mo"
|
||||
)
|
||||
@@ -91,6 +95,11 @@ class Settings(BaseSettings):
|
||||
"""Retourne la taille max en octets."""
|
||||
return self.MAX_UPLOAD_SIZE_MB * 1024 * 1024
|
||||
|
||||
@property
|
||||
def upload_dir_path(self) -> Path:
|
||||
"""Retourne le chemin du répertoire d'uploads comme Path."""
|
||||
return Path(self.UPLOAD_DIR).resolve()
|
||||
|
||||
# === Recherche ===
|
||||
SEARCH_MIN_QUERY_LENGTH: int = Field(
|
||||
default=2, description="Longueur minimale des requêtes de recherche"
|
||||
|
||||
Reference in New Issue
Block a user