Mirrors /opt/ai-apps/eh-search/ on the server, including the full FastAPI app (intent routing, FTS+fuzzy+substring hybrid, multi-source federation across vehicles + blog + brands + pages + static + tag bridge), SQL schema (Postgres materialized view with german_unaccent text search, pg_trgm for fuzzy), Dockerfile and compose. Sanitized the hardcoded password in sql/01_init.sql — replaced with REPLACE_ME_BEFORE_APPLYING placeholder since this repo is public. The eh-search service binds only on the private network (10.0.0.8:8200) and is reachable only via Pegasus nginx proxy at /api/search. Refs OP#1094 OP#1105 OP#1112 OP#1116 OP#1117
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
"""Configuration via environment variables (Pydantic Settings)."""
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
environment: str = "dev"
|
|
|
|
# Postgres
|
|
db_host: str
|
|
db_port: int = 5433
|
|
db_name: str = "eh_vehicles"
|
|
db_user: str = "search_read"
|
|
db_password: str
|
|
|
|
# Redis
|
|
redis_host: str = "eh-search-redis"
|
|
redis_port: int = 6379
|
|
redis_db: int = 0
|
|
|
|
# Cache TTLs
|
|
cache_ttl_result: int = 60
|
|
cache_ttl_suggest: int = 600
|
|
cache_ttl_empty: int = 300
|
|
|
|
# Directus
|
|
directus_url: str = "http://10.0.0.10:8055"
|
|
directus_slug_refresh_seconds: int = 300
|
|
|
|
# CORS
|
|
cors_origins: str = ""
|
|
|
|
@property
|
|
def dsn(self) -> str:
|
|
return (
|
|
f"postgresql://{self.db_user}:{self.db_password}"
|
|
f"@{self.db_host}:{self.db_port}/{self.db_name}"
|
|
)
|
|
|
|
@property
|
|
def cors_origin_list(self) -> list[str]:
|
|
return [o.strip() for o in self.cors_origins.split(",") if o.strip()]
|
|
|
|
|
|
settings = Settings()
|