Files
board-mate/api/mosquitto/config/init-mosquitto.sh
2025-12-29 18:46:32 +01:00

20 lines
533 B
Bash

#!/bin/sh
PASSWORD_FILE=/mosquitto/config/passwords
echo "Creating password file with pre-registered users..."
if [ ! -f "$PASSWORD_FILE" ]; then
touch "$PASSWORD_FILE"
chmod 600 "$PASSWORD_FILE"
# Add pre-registered users
mosquitto_passwd -b "$PASSWORD_FILE" board-mate-api hepl
mosquitto_passwd -b "$PASSWORD_FILE" customer hepl
echo "Password file created !"
else
echo "Password file exists, skipping this step"
fi
echo "Starting mosquitto..."
exec mosquitto -c /mosquitto/config/mosquitto.conf -v