93da909b0a
Update the Dockerfile entrypoint script to use the correct version flag syntax. The flag now requires two dashes instead of one. The syntax for the texfile collector has also change, and the script was updated accordingly. Fix incorrect order of variable assignment when parsing CLI flags.
22 lines
678 B
Bash
22 lines
678 B
Bash
#/bin/sh
|
|
|
|
# Print version to logs for debugging purposes
|
|
/app/fail2ban-prometheus-exporter --version
|
|
|
|
socket_path=/var/run/fail2ban/fail2ban.sock
|
|
textfile_dir=/app/textfile/
|
|
textfile_enabled=false
|
|
|
|
# Start the exporter (use exec to support graceful shutdown)
|
|
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
|
|
# Enable textfile metrics if the folder exists (i.e. was mounted by docker)
|
|
if [ -d $textfile_dir ]; then
|
|
exec /app/fail2ban-prometheus-exporter \
|
|
--socket "$socket_path" \
|
|
--collector.textfile \
|
|
--collector.textfile.directory "$textfile_dir"
|
|
else
|
|
exec /app/fail2ban-prometheus-exporter \
|
|
--socket "$socket_path"
|
|
fi
|