Merge branch '18-dash-missing-in-docker-run-sh-line-4-version' into 'main'
Resolve "Dash missing in /docker/run.sh line 4 "-version"" Closes #18 See merge request hectorjsmith/fail2ban-prometheus-exporter!55
This commit is contained in:
commit
191dda3b9f
@ -1,20 +1,21 @@
|
|||||||
#/bin/sh
|
#/bin/sh
|
||||||
|
|
||||||
# Print version to logs for debugging purposes
|
# Print version to logs for debugging purposes
|
||||||
/app/fail2ban-prometheus-exporter -version
|
/app/fail2ban-prometheus-exporter --version
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
# Enable textfile metrics if the folder exists (i.e. was mounted by docker)
|
|
||||||
if [ -d $textfile_dir ]; then
|
|
||||||
textfile_enabled=true
|
|
||||||
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 \
|
# 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" \
|
--socket "$socket_path" \
|
||||||
--collector.textfile=$textfile_enabled \
|
--collector.textfile \
|
||||||
--collector.textfile.directory="$textfile_dir"
|
--collector.textfile.directory "$textfile_dir"
|
||||||
|
else
|
||||||
|
exec /app/fail2ban-prometheus-exporter \
|
||||||
|
--socket "$socket_path"
|
||||||
|
fi
|
||||||
|
@ -81,6 +81,8 @@ func readParamsFromCli(settings *AppSettings) {
|
|||||||
Envar(basicAuthPassEnvName).
|
Envar(basicAuthPassEnvName).
|
||||||
String()
|
String()
|
||||||
|
|
||||||
|
kingpin.Parse()
|
||||||
|
|
||||||
settings.VersionMode = *versionMode
|
settings.VersionMode = *versionMode
|
||||||
settings.MetricsPort = *port
|
settings.MetricsPort = *port
|
||||||
settings.MetricsAddress = *address
|
settings.MetricsAddress = *address
|
||||||
@ -88,8 +90,6 @@ func readParamsFromCli(settings *AppSettings) {
|
|||||||
settings.FileCollectorEnabled = *fileCollectorEnabled
|
settings.FileCollectorEnabled = *fileCollectorEnabled
|
||||||
settings.FileCollectorPath = *fileCollectorPath
|
settings.FileCollectorPath = *fileCollectorPath
|
||||||
settings.setBasicAuthValues(*rawBasicAuthUsername, *rawBasicAuthPassword)
|
settings.setBasicAuthValues(*rawBasicAuthUsername, *rawBasicAuthPassword)
|
||||||
|
|
||||||
kingpin.Parse()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (settings *AppSettings) setBasicAuthValues(rawUsername, rawPassword string) {
|
func (settings *AppSettings) setBasicAuthValues(rawUsername, rawPassword string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user