Compare commits

...

2 Commits

5 changed files with 26 additions and 6 deletions

View File

@@ -110,4 +110,4 @@ docker compose exec postgres pg_dump -U miem miem_workers > backup.sql
docker compose down
```
Версия сервиса: `0.2.6`. Админка всегда показывает версии backend и frontend в footer.
Версия сервиса: `0.2.7`. Админка всегда показывает версии backend и frontend в footer.

View File

@@ -1,5 +1,5 @@
from functools import lru_cache
from pydantic import Field
from pydantic import Field, field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
@@ -19,6 +19,13 @@ class Settings(BaseSettings):
session_secret: str = Field(default="dev-session-secret", min_length=8)
mcp_token: str = "dev-mcp-token"
@field_validator("crawl_limit", mode="before")
@classmethod
def empty_crawl_limit_as_none(cls, value):
if value == "":
return None
return value
@lru_cache
def get_settings() -> Settings:

View File

@@ -1,3 +1,3 @@
APP_VERSION = "0.2.6"
FRONTEND_VERSION = "0.2.6"
BACKEND_VERSION = "0.2.6"
APP_VERSION = "0.2.7"
FRONTEND_VERSION = "0.2.7"
BACKEND_VERSION = "0.2.7"

View File

@@ -18,7 +18,7 @@ def test_health_returns_versions():
response = client.get("/api/health")
assert response.status_code == 200
assert response.json()["backend_version"] == "0.2.6"
assert response.json()["backend_version"] == "0.2.7"
def test_mcp_requires_token_and_lists_tools():

13
tests/test_config.py Normal file
View File

@@ -0,0 +1,13 @@
from app.config import Settings
def test_empty_crawl_limit_is_treated_as_none():
settings = Settings(crawl_limit="")
assert settings.crawl_limit is None
def test_numeric_crawl_limit_is_parsed():
settings = Settings(crawl_limit="25")
assert settings.crawl_limit == 25