from pathlib import Path
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
class Settings(BaseSettings):
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
|
host: str = "0.0.0.0"
|
port: int = 9500
|
data_dir: Path = Path(__file__).resolve().parents[2] / "data"
|
|
mqtt_broker: str = "124.222.109.197"
|
mqtt_port: int = 2100
|
mqtt_username: str = "AI_XIAOZHI"
|
mqtt_password: str = "V9qL7!mX2@rT8$kN5^wP1&c"
|
mqtt_client_id: str = "snlp-server"
|
mqtt_enabled: bool = True
|
|
scene_confidence_threshold: float = 0.7
|
base_url: str = "http://localhost:9500"
|
|
runtime_dir: Path = Path(__file__).resolve().parents[1] / "runtime"
|
initialized_devices_file: Path | None = None
|
auto_init_enabled: bool = True
|
device_data_root: str = "/data"
|
|
@property
|
def resolved_initialized_devices_file(self) -> Path:
|
if self.initialized_devices_file:
|
return self.initialized_devices_file
|
return self.runtime_dir / "initialized_devices.json"
|
|
settings = Settings()
|