update docker entrypoint script

This commit is contained in:
Hector 2021-10-15 18:08:32 +01:00
parent 3953337ea0
commit 5518369758

View File

@ -3,18 +3,11 @@
# Print version to logs for debugging purposes # Print version to logs for debugging purposes
/app/fail2ban-prometheus-exporter -version /app/fail2ban-prometheus-exporter -version
db_path=/app/fail2ban.sqlite3
socket_path=/var/run/fail2ban/fail2ban.sock socket_path=/var/run/fail2ban/fail2ban.sock
textfile_dir=/app/textfile/ textfile_dir=/app/textfile/
textfile_enabled=false textfile_enabled=false
# Blank out the file paths if they do not exist - a hacky way to only use these files if they were mounted into the container. # Enable textfile metrics if the folder exists (i.e. was mounted by docker)
if [ ! -f "$db_path" ]; then
db_path=""
fi
if [ ! -S "$socket_path" ]; then
socket_path=""
fi
if [ -d $textfile_dir ]; then if [ -d $textfile_dir ]; then
textfile_enabled=true textfile_enabled=true
fi fi
@ -22,7 +15,6 @@ fi
# Start the exporter (use exec to support graceful shutdown) # Start the exporter (use exec to support graceful shutdown)
# Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/ # Inspired by: https://akomljen.com/stopping-docker-containers-gracefully/
exec /app/fail2ban-prometheus-exporter \ exec /app/fail2ban-prometheus-exporter \
-db "$db_path" \
-socket "$socket_path" \ -socket "$socket_path" \
-collector.textfile=$textfile_enabled \ -collector.textfile=$textfile_enabled \
-collector.textfile.directory="$textfile_dir" -collector.textfile.directory="$textfile_dir"