Added ssl/tls support

This commit is contained in:
mahdium committed 2025-10-02 10:18:50 +03:30
1 parent 349287cf8c
commit 4de23d2cc9
7 files changed
+74 -14

No files matched your search

+7
View File
@@ -13,6 +13,7 @@ type Config struct {
Username string
Password string
Topics []string
CACert string
}
func NewConfig(logger *zap.Logger) *Config {
@@ -51,10 +52,16 @@ func NewConfig(logger *zap.Logger) *Config {
}
}
caCert := os.Getenv("MQTT_CACERT")
if caCert == "" {
logger.Warn("MQTT_CACERT is not set, not using TLS")
}
return &Config{
URI: uri,
Username: username,
Password: password,
Topics: topics,
CACert: caCert,
}
}