From a7439184eed8cad9a3e8c50f916e5d9848ce3f29 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Mon, 9 Sep 2024 15:36:08 +0200 Subject: [PATCH] feat: add support for TLS authentication --- ioTSensorsMQTT/utils/config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ioTSensorsMQTT/utils/config.go b/ioTSensorsMQTT/utils/config.go index 9fd3ac2..ae4bc03 100644 --- a/ioTSensorsMQTT/utils/config.go +++ b/ioTSensorsMQTT/utils/config.go @@ -16,6 +16,9 @@ type mqttBroker struct { ServerURL string `mapstructure:"SERVER_URL"` User string `mapstructure:"SERVER_USER"` Pwd string `mapstructure:"SERVER_PWD"` + TLSCAFile string `mapstructure:"SERVER_TLS_CA_FILE"` + TLSCertFil string `mapstructure:"SERVER_TLS_CERT_FILE"` + TLSKeyFile string `mapstructure:"SERVER_TLS_KEY_FILE"` Retain bool `mapstructure:"SERVER_RETAIN"` Qos byte `mapstructure:"SERVER_QOS"` ClientID string `mapstructure:"CLIENT_ID"` @@ -70,6 +73,9 @@ func setDefault(v *viper.Viper) { viper.SetDefault("SERVER_URL", "mqtt://broker.hivemq.com:1883") viper.SetDefault("SERVER_USER", "") viper.SetDefault("SERVER_PWD", "") + viper.SetDefault("SERVER_TLS_CA_FILE", "") + viper.SetDefault("SERVER_TLS_CERT_FILE", "") + viper.SetDefault("SERVER_TLS_KEY_FILE", "") viper.SetDefault("SERVER_QOS", 2) viper.SetDefault("SERVER_RETAIN", "true") viper.SetDefault("CLIENT_ID", "IoTSensorsMQTT-Simulator")