Added ssl/tls support
This commit is contained in:
1 parent
349287cf8c
commit
4de23d2cc9
7 files changed
+74
-14
No files matched your search
@@ -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,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user