Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Commit

Permalink
🚑 Fix quoting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Mar 25, 2019
1 parent df56330 commit 4d9dd7a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mqtt/rootfs/etc/cont-init.d/20-mqtt_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,18 @@ if bashio::config.true 'broker.enabled'; then
echo "acl_file $ACL_FILE" >> "$CONFIG"
echo "password_file $PWFILE" >> "$CONFIG"
for user in $(bashio::config 'mqttusers'); do
username=$(jq '.username' <<< "${user}")
password=$(jq '.password' <<< "${user}")
readonly=$(jq '.readonly' <<< "${user}")
topics=$(jq '.topics' <<< "${user}" | jq .[])
username=$(jq -r '.username' <<< "${user}")
password=$(jq -r '.password' <<< "${user}")
readonly=$(jq -r '.readonly' <<< "${user}")
topics=$(jq '.topics' <<< "${user}" | jq -r .[])
bashio::log.info "Setting up user ${username}"
mosquitto_passwd -b "$PWFILE" "${username}" "${password}"
echo "user ${username}" >> "$ACL_FILE"
mosquitto_passwd -b "$PWFILE" "$username" "$password"
echo "user $username" >> "$ACL_FILE"
for topic in ${topics}; do
if ${readonly}; then
echo "topic read ${topic}" >> "$ACL_FILE"
echo "topic read $topic" >> "$ACL_FILE"
else
echo "topic readwrite ${topic}" >> "$ACL_FILE"
echo "topic readwrite $topic" >> "$ACL_FILE"
fi
done
done
Expand Down

0 comments on commit 4d9dd7a

Please sign in to comment.