Some MQTT-brokers accept auth-tokens as username (e.g. mqtt.flespi.io). In man mosquitto_pub
I found that clients support configuration files:
FILES
$XDG_CONFIG_HOME/mosquitto_sub, $HOME/.config/mosquitto_pub Configuration file for default options.
But there are no clarification about file format. I tried this:
username=foobar..token
# and
username foobar..token
# and
--username=foobar..token
# and
[email protected]:port
# and some other
# that I found in https://github.com/eclipse/mosquitto/blob/master/client/client_shared.c
but in all cases I have just
Error: Unknown option '--username.. and so on'.
and I'm not very good at C-lang.. Can someone please tell me how to cook it right?
A-ha, seems I found it (in the last possible combination I didn't test):
# ~/.config/mosquitto_pub
--username <username-or-token>
-h <broker.addre.ss>
# and so on
So, proper format is with leadig dashes and without equal sign
Now it allows to exec mosquitto_pub
with short parameter list:
mosquitto_pub -t mydata/update -m 4