This commit is contained in:
2026-01-12 22:32:18 +01:00
parent cdf6a6c44a
commit a93c0e124e
4 changed files with 16 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
{
"mqtt": {
"broker": "mqtt://172.23.1.102:1883",
"broker": "mqtt://172.23.1.101:8883",
"username": "archiver",
"tlsEnable": "true"
},

View File

@@ -14,9 +14,9 @@
"cem/#"
],
"syslog": {
"enable": "false",
"enable": "true",
"network": "udp",
"server": "syslog-server:514",
"server": "172.20.0.10:514",
"facility": "local0",
"severity": "info",
"tag": "mqtt-archiver"

View File

@@ -21,6 +21,8 @@ func InitSyslog() {
priority := facility | severity
var err error
// Connect to remote syslog server
syslogWriter, err = syslog.Dial(
config.Config.Syslog.Network,
config.Config.Syslog.Server,

View File

@@ -14,7 +14,7 @@ type ConfigT struct {
Mqtt struct {
Broker string `json:"broker"`
Username string `json:"username"`
Password string
Password string `json:"password"`
TlsEnable string `json:"tlsEnable"`
} `json:"mqtt"`
IncludeTopics []string `json:"includeTopics"`
@@ -37,5 +37,8 @@ func LoadConfiguration() {
log.Fatalf("Unable to parse configuration: %s", err)
}
Config.Mqtt.Password = os.Getenv("MQTT_PASSWORD")
// Load password from environment variable only if not set in config
if Config.Mqtt.Password == "" {
Config.Mqtt.Password = os.Getenv("MQTT_PASSWORD")
}
}