Manager: set default MQTT topic prefix to 'flamenco'

Set the default MQTT topic prefix to 'flamenco'. It can still be overridden
by the config in the YAML file, but it's nice to have a sensible default
when people don't configure this.
This commit is contained in:
Sybren A. Stüvel 2024-03-08 16:44:39 +01:00
parent b476e31c0c
commit d1fbe8b9f9
2 changed files with 12 additions and 2 deletions

@ -4,6 +4,7 @@ import (
"runtime"
"time"
"projects.blender.org/studio/flamenco/internal/manager/eventbus"
shaman_config "projects.blender.org/studio/flamenco/pkg/shaman/config"
)
@ -39,6 +40,13 @@ var defaultConfig = Conf{
BlocklistThreshold: 3,
TaskFailAfterSoftFailCount: 3,
MQTT: MQTTConfig{
Client: eventbus.MQTTClientConfig{
ClientID: eventbus.MQTTDefaultClientID,
TopicPrefix: eventbus.MQTTDefaultTopicPrefix,
},
},
},
Variables: map[string]Variable{

@ -18,7 +18,9 @@ import (
)
const (
defaultClientID = "flamenco"
MQTTDefaultTopicPrefix = "flamenco"
MQTTDefaultClientID = "flamenco"
keepAlive = 30 // seconds
connectRetryDelay = 10 * time.Second
@ -63,7 +65,7 @@ func NewMQTTForwarder(config MQTTClientConfig) *MQTTForwarder {
return nil
}
if config.ClientID == "" {
config.ClientID = defaultClientID
config.ClientID = MQTTDefaultClientID
}
brokerURL, err := url.Parse(config.BrokerURL)