mqtt
Some checks failed
CI / Test (1.22) (push) Failing after -23m51s
CI / Test (1.23) (push) Failing after -23m51s
CI / Lint (push) Has been cancelled
CI / Build (push) Has been cancelled
Release / Build and Release (push) Successful in -18m25s

This commit is contained in:
2025-12-29 23:36:22 +02:00
parent fd2527219e
commit ea1209c84c
14 changed files with 864 additions and 46 deletions

View File

@@ -97,13 +97,29 @@ type MediaConfig struct {
// EventLoggerConfig holds event logging configuration
type EventLoggerConfig struct {
Enabled bool `json:"enabled"`
Targets []string `json:"targets"` // "file", "sqlite", "postgres"
Targets []string `json:"targets"` // "file", "sqlite", "postgres", "mqtt"
// File-based logging
FileDir string `json:"file_dir,omitempty"` // Base directory for event files
// Database logging (uses main Database config for connection)
TableName string `json:"table_name,omitempty"` // Table name for event logs (default: "event_logs")
// MQTT logging
MQTT MQTTConfig `json:"mqtt,omitempty"` // MQTT broker configuration
}
// MQTTConfig holds MQTT broker configuration
type MQTTConfig struct {
Broker string `json:"broker"` // MQTT broker URL (e.g., "tcp://localhost:1883")
ClientID string `json:"client_id,omitempty"` // Client ID (auto-generated if empty)
Username string `json:"username,omitempty"` // Username for authentication
Password string `json:"password,omitempty"` // Password for authentication
TopicPrefix string `json:"topic_prefix,omitempty"` // Topic prefix (default: "whatshooked")
QoS int `json:"qos,omitempty"` // Quality of Service (0, 1, or 2; default: 1)
Retained bool `json:"retained,omitempty"` // Retain messages on broker
Events []string `json:"events,omitempty"` // Events to publish (empty = all events)
Subscribe bool `json:"subscribe,omitempty"` // Enable subscription for sending messages
}
// Load reads configuration from a file