update: Major Overhaul to all subsystems
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import List
|
||||
from typing import List, Dict, Any
|
||||
import json
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class Settings(BaseSettings):
|
||||
mqtt_admin_password: str = ""
|
||||
mqtt_secret: str = "change-me-in-production"
|
||||
mosquitto_password_file: str = "/etc/mosquitto/passwd"
|
||||
mqtt_client_id: str = "bellsystems-admin-panel"
|
||||
|
||||
# SQLite (MQTT data storage)
|
||||
sqlite_db_path: str = "./mqtt_data.db"
|
||||
@@ -37,6 +38,30 @@ class Settings(BaseSettings):
|
||||
backend_cors_origins: str = '["http://localhost:5173"]'
|
||||
debug: bool = True
|
||||
|
||||
# Nextcloud WebDAV
|
||||
nextcloud_url: str = ""
|
||||
nextcloud_username: str = "" # WebDAV login & URL path username
|
||||
nextcloud_password: str = "" # Use an app password for better security
|
||||
nextcloud_dav_user: str = "" # Override URL path username if different from login
|
||||
nextcloud_base_path: str = "BellSystems"
|
||||
|
||||
# IMAP/SMTP Email
|
||||
imap_host: str = ""
|
||||
imap_port: int = 993
|
||||
imap_username: str = ""
|
||||
imap_password: str = ""
|
||||
imap_use_ssl: bool = True
|
||||
smtp_host: str = ""
|
||||
smtp_port: int = 587
|
||||
smtp_username: str = ""
|
||||
smtp_password: str = ""
|
||||
smtp_use_tls: bool = True
|
||||
email_sync_interval_minutes: int = 15
|
||||
# Multi-mailbox config (JSON array). If empty, legacy single-account IMAP/SMTP is used.
|
||||
# Example item:
|
||||
# {"key":"sales","label":"Sales","email":"sales@bellsystems.gr","imap_host":"...","imap_username":"...","imap_password":"...","smtp_host":"...","smtp_username":"...","smtp_password":"...","sync_inbound":true,"allow_send":true}
|
||||
mail_accounts_json: str = "[]"
|
||||
|
||||
# Auto-deploy (Gitea webhook)
|
||||
deploy_secret: str = ""
|
||||
deploy_project_path: str = "/app"
|
||||
@@ -45,6 +70,14 @@ class Settings(BaseSettings):
|
||||
def cors_origins(self) -> List[str]:
|
||||
return json.loads(self.backend_cors_origins)
|
||||
|
||||
@property
|
||||
def mail_accounts(self) -> List[Dict[str, Any]]:
|
||||
try:
|
||||
raw = json.loads(self.mail_accounts_json or "[]")
|
||||
return raw if isinstance(raw, list) else []
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
model_config = {"env_file": ".env", "extra": "ignore"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user