Make mqtt user/passwd optional

This commit is contained in:
niten 2023-05-18 09:51:15 -07:00
parent 1ab07a53b1
commit bb25cc2c97
2 changed files with 2 additions and 1 deletions

View File

@ -55,6 +55,7 @@ in {
"--mqtt-host=${cfg.mqtt.host}" "--mqtt-host=${cfg.mqtt.host}"
"--mqtt-port=${toString cfg.mqtt.port}" "--mqtt-port=${toString cfg.mqtt.port}"
"--notification-topic=${cfg.notification-topic}" "--notification-topic=${cfg.notification-topic}"
"--app-name=tattler"
] ++ (optional cfg.verbose "--verbose") ] ++ (optional cfg.verbose "--verbose")
++ (optional (cfg.mqtt.user != null) "--mqtt-user=${cfg.mqtt.user}") ++ (optional (cfg.mqtt.user != null) "--mqtt-user=${cfg.mqtt.user}")
++ (optional (cfg.mqtt.password-file != null) ++ (optional (cfg.mqtt.password-file != null)

View File

@ -42,7 +42,7 @@
(update result :errors concat missing-errors))) (update result :errors concat missing-errors)))
(defn -main [& args] (defn -main [& args]
(let [required-args #{:mqtt-host :mqtt-port :mqtt-user :mqtt-password-file :app-name :notification-topic} (let [required-args #{:mqtt-host :mqtt-port :app-name :notification-topic}
{:keys [options _ errors summary]} (parse-opts args required-args cli-opts)] {:keys [options _ errors summary]} (parse-opts args required-args cli-opts)]
(when (seq errors) (msg-quit 1 (usage summary errors))) (when (seq errors) (msg-quit 1 (usage summary errors)))
(let [{:keys [mqtt-host mqtt-port mqtt-user mqtt-password-file app-name notification-topic]} options (let [{:keys [mqtt-host mqtt-port mqtt-user mqtt-password-file app-name notification-topic]} options