feat(mcp-docugen): Task 1-3 config, models, auth middleware
- Settings con Pydantic Settings, validazione env obbligatori - Shared models: TemplateVariable/Frontmatter, ImageVariable, TokenUsage, GenerationResult, TemplateSummary, TemplateAsset - ApiKeyAuthMiddleware Bearer token con exempt paths 19 test, tutti passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic import Field, field_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||
)
|
||||
|
||||
api_key: str = Field(..., min_length=8)
|
||||
openrouter_api_key: str = Field(..., min_length=8)
|
||||
openrouter_base_url: str = "https://openrouter.ai/api/v1"
|
||||
llm_model_default: str = "anthropic/claude-sonnet-4"
|
||||
public_base_url: str = Field(...)
|
||||
data_dir: Path = Path("/data")
|
||||
asset_ttl_days: int = 30
|
||||
max_image_size_mb: int = 10
|
||||
llm_timeout_seconds: int = 60
|
||||
|
||||
@field_validator("public_base_url")
|
||||
@classmethod
|
||||
def strip_trailing_slash(cls, v: str) -> str:
|
||||
return v.rstrip("/")
|
||||
Reference in New Issue
Block a user