mosquitto/docker/2.0-openssl/docker-entrypoint.sh
Roger A. Light 12ff9d5e14 Allow Docker images to run with anon, without a config file.
Provide a mechanism for Docker users to run a broker that doesn't use
authentication, without having to provide their own configuration file.

Closes #2040.
2021-02-25 13:51:27 +00:00

18 lines
523 B
Bash
Executable File

#!/bin/ash
set -e
# Set permissions
user="$(id -u)"
if [ "$user" = '0' ]; then
[ -d "/mosquitto" ] && chown -R mosquitto:mosquitto /mosquitto || true
fi
if [ "$NO_AUTHENTICATION" = "1" ] && [ "$*" = '/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf' ]; then
# The user wants to run Mosquitto with no authentication, but without
# providing a configuration file. Use the pre-provided file for this.
exec /usr/sbin/mosquitto -c /mosquitto-no-auth.conf
else
# Execute whatever command is requested
exec "$@"
fi