Sebas Tin angelegt und Synology Chat connected

This commit is contained in:
Sithies
2026-03-16 21:13:37 +01:00
parent f686c4c6e2
commit 204b2d6eb1
19 changed files with 907 additions and 3 deletions
+37
View File
@@ -0,0 +1,37 @@
// crates/nazarick/src/config.rs
use serde::Deserialize;
use crate::chat::types::AgentChatConfig;
/// Wurzel der gesamten Nazarick-Konfiguration.
/// Entspricht dem obersten Level in config.toml.
#[derive(Debug, Deserialize)]
pub struct NazarickConfig {
/// Alles unter [chat] in config.toml
pub chat: ChatConfig,
}
/// Konfiguration für den Chat-Connector.
/// Entspricht dem [chat]-Block in config.toml.
#[derive(Debug, Deserialize)]
pub struct ChatConfig {
/// Port auf dem Nazarick auf eingehende Webhooks lauscht
pub listen_port: u16,
/// Synology User-ID des Admins — bekommt System-Benachrichtigungen
pub admin_user_id: u64,
/// Basis Webhook URL für Admin-Benachrichtigungen — ohne user_ids Parameter
pub admin_webhook_url: String,
/// Liste aller konfigurierten Bot-Agenten
pub agents: Vec<AgentChatConfig>,
}
/// Lädt die Konfiguration aus config.toml im Arbeitsverzeichnis.
/// Gibt einen Fehler zurück wenn die Datei fehlt oder ungültig ist.
pub fn load() -> anyhow::Result<NazarickConfig> {
let content = std::fs::read_to_string("config.toml")?;
let config = toml::from_str(&content)?;
Ok(config)
}