Initial MCM project: FastAPI + Textual TUI unified messenger

MultiCustomerMessenger supporting Telegram (python-telegram-bot),
WhatsApp (Green API) and SMS (python-gsmmodem-new). REST API with
Bearer-token auth, SQLAlchemy models for MariaDB, APScheduler for
background polling, and Textual TUI running in same asyncio event-loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 14:43:19 +01:00
commit 7a8c8149c9
38 changed files with 2072 additions and 0 deletions

43
config.py Normal file
View File

@@ -0,0 +1,43 @@
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
# API
api_key: str = "changeme-secret-key"
host: str = "0.0.0.0"
port: int = 8000
debug: bool = False
# Telegram
telegram_token: str = ""
# WhatsApp (Green API)
whatsapp_id_instance: str = ""
whatsapp_api_token: str = ""
# SMS / USB-Modem
sms_port: str = "/dev/ttyUSB0"
sms_baud_rate: int = 115200
sms_enabled: bool = False
# Datenbank
database_url: str = "sqlite:///./mcm.db"
@property
def telegram_enabled(self) -> bool:
return bool(self.telegram_token)
@property
def whatsapp_enabled(self) -> bool:
return bool(self.whatsapp_id_instance and self.whatsapp_api_token)
@lru_cache
def get_settings() -> Settings:
return Settings()
settings = get_settings()