CUB-117: Port Moonraker + MQTT printer integrations to Go
All checks were successful
Dev Build / build-test (pull_request) Successful in 1m29s

- Moonraker REST client with GetPrinterInfo, GetPrintStats, GetPrintHistory
- Moonraker WebSocket client with auto-reconnect + telemetry parsing
- MQTT client via paho.mqtt.golang with TLS support for Bambu Lab
- Moonraker poller worker: background polling, dedup, usage logging to PostgreSQL
- MQTT subscriber worker: Bambu telemetry parsing, print job tracking
- Config: 7 new env vars (MOONRAKER_URL, MQTT_BROKER, etc.)
- main.go: per-printer worker discovery, graceful shutdown
This commit is contained in:
2026-05-12 01:02:49 -04:00
parent f1614029b5
commit 38722e54e6
9 changed files with 1169 additions and 32 deletions

View File

@@ -12,6 +12,17 @@ type Config struct {
Port string `envconfig:"port" default:"8080"`
CorsOrigin string `envconfig:"cors_origin" default:"*"`
LogLevel string `envconfig:"log_level" default:"info"`
// Moonraker integration.
MoonrakerURL string `envconfig:"moonraker_url" default:"http://localhost:7125"`
MoonrakerPollInterval string `envconfig:"moonraker_poll_interval" default:"10s"`
// MQTT (Bambu Lab) integration.
MQTTBroker string `envconfig:"mqtt_broker" default:"localhost:1883"`
MQTTTopicPrefix string `envconfig:"mqtt_topic_prefix" default:"device/+/report"`
MQTTClientID string `envconfig:"mqtt_client_id" default:"extrudex"`
MQTTTLSCert string `envconfig:"mqtt_tls_cert" default:""`
MQTTTLSKey string `envconfig:"mqtt_tls_key" default:""`
}
// Load reads configuration from environment variables and returns a populated Config.