Don't always try using password-file

This commit is contained in:
niten 2023-05-18 11:09:07 -07:00
parent 9226793455
commit 5fc207e38a
1 changed files with 8 additions and 6 deletions

View File

@ -47,12 +47,14 @@
(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
catch-shutdown (async/chan) catch-shutdown (async/chan)
mqtt-client (mqtt/connect-json! :host mqtt-host mqtt-client (if mqtt-user
:port mqtt-port (mqtt/connect-json! :host mqtt-host
:username mqtt-user :port mqtt-port
:password (-> mqtt-password-file :username mqtt-user
(slurp) :password (-> mqtt-password-file
(str/trim))) (slurp)
(str/trim)))
(mqtt/connect-json! :host mqtt-host :port mqtt-port))
logger (log/print-logger)] logger (log/print-logger)]
(tattler/listen! :app app-name (tattler/listen! :app app-name
:mqtt-client mqtt-client :mqtt-client mqtt-client