Spaces:
Running
Running
Fix: Add validator for Qdrant :memory: URL
Browse files- app/core/config.py +9 -1
app/core/config.py
CHANGED
|
@@ -6,7 +6,7 @@ Handles application configuration using Pydantic Settings.
|
|
| 6 |
from functools import lru_cache
|
| 7 |
from typing import List
|
| 8 |
|
| 9 |
-
from pydantic import Field
|
| 10 |
from pydantic_settings import BaseSettings, SettingsConfigDict
|
| 11 |
|
| 12 |
|
|
@@ -114,6 +114,14 @@ class Settings(BaseSettings):
|
|
| 114 |
algorithm: str = Field(default="HS256")
|
| 115 |
access_token_expire_minutes: int = Field(default=30)
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
@lru_cache
|
| 119 |
def get_settings() -> Settings:
|
|
|
|
| 6 |
from functools import lru_cache
|
| 7 |
from typing import List
|
| 8 |
|
| 9 |
+
from pydantic import Field, field_validator
|
| 10 |
from pydantic_settings import BaseSettings, SettingsConfigDict
|
| 11 |
|
| 12 |
|
|
|
|
| 114 |
algorithm: str = Field(default="HS256")
|
| 115 |
access_token_expire_minutes: int = Field(default=30)
|
| 116 |
|
| 117 |
+
@field_validator('qdrant_url', mode='before')
|
| 118 |
+
@classmethod
|
| 119 |
+
def validate_qdrant_url(cls, v):
|
| 120 |
+
"""Allow :memory: as a valid Qdrant URL"""
|
| 121 |
+
if v == ":memory:" or v.startswith("memory://"):
|
| 122 |
+
return v
|
| 123 |
+
return v
|
| 124 |
+
|
| 125 |
|
| 126 |
@lru_cache
|
| 127 |
def get_settings() -> Settings:
|