32 lines
837 B
Python
32 lines
837 B
Python
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||
|
|
|
||
|
|
|
||
|
|
BASE_DIR = Path(__file__).resolve().parents[2]
|
||
|
|
|
||
|
|
|
||
|
|
class Settings(BaseSettings):
|
||
|
|
app_name: str = "电气量测控平台"
|
||
|
|
app_version: str = "0.1.0"
|
||
|
|
api_prefix: str = "/api"
|
||
|
|
realtime_ws_path: str = "/ws/real-time"
|
||
|
|
alarm_ws_path: str = "/ws/alarm"
|
||
|
|
poll_interval_seconds: float = 0.5
|
||
|
|
auth_password: str = "admin123"
|
||
|
|
use_mock_device: bool = True
|
||
|
|
config_dir: Path = BASE_DIR / "config"
|
||
|
|
data_dir: Path = BASE_DIR / "data"
|
||
|
|
alarm_db_path: Path = BASE_DIR / "data" / "alarm.db"
|
||
|
|
backup_dir: Path = BASE_DIR / "data" / "backups"
|
||
|
|
|
||
|
|
model_config = SettingsConfigDict(
|
||
|
|
env_prefix="EMCP_",
|
||
|
|
env_file=".env",
|
||
|
|
env_file_encoding="utf-8",
|
||
|
|
extra="ignore",
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
settings = Settings()
|