You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lenmonitor/entrypoint.sh

73 lines
1.6 KiB
Bash

#!/bin/sh
set -e
RUN_CMD="lenmonitor"
# LENMONITOR_ADDRESS
if [[ -n "$LENMONITOR_ADDRESS" ]]; then
RUN_CMD="$RUN_CMD -address $LENMONITOR_ADDRESS"
fi
# LENMONITOR_DB_DRIVER
if [[ -n "$LENMONITOR_DB_DRIVER" ]]; then
RUN_CMD="$RUN_CMD -db-driver '$LENMONITOR_DB_DRIVER'"
fi
# LENMONITOR_DB_SOURCE
if [[ -z "$LENMONITOR_DB_DRIVER" || "$LENMONITOR_DB_DRIVER" == "sqlite3" ]]; then
RUN_CMD="$RUN_CMD -db-source /data/lenmonitor.db"
else
RUN_CMD="$RUN_CMD -db-source '$LENMONITOR_DB_SOURCE'"
fi
# LENMONITOR_DB_MAX_OPEN_CONNS
if [[ -n "$LENMONITOR_DB_MAX_OPEN_CONNS" ]]; then
RUN_CMD="$RUN_CMD -db-max-open-conns '$LENMONITOR_DB_MAX_OPEN_CONNS'"
fi
# LENMONITOR_DB_MAX_IDLE_CONNS
if [[ -n "$LENMONITOR_DB_MAX_IDLE_CONNS" ]]; then
RUN_CMD="$RUN_CMD -db-max-idle-conns '$LENMONITOR_DB_MAX_IDLE_CONNS'"
fi
# LENMONITOR_ROBOTS_DISALLOW
if [[ "$LENMONITOR_ROBOTS_DISALLOW" == "true" ]]; then
RUN_CMD="$RUN_CMD -robots-disallow"
else
if [[ "$LENMONITOR_ROBOTS_DISALLOW" != "" && "$LENMONITOR_ROBOTS_DISALLOW" != "false" ]]; then
echo "[ENTRYPOINT] Error: unknown: LENMONITOR_ROBOTS_DISALLOW = $LENMONITOR_ROBOTS_DISALLOW"
exit 2
fi
fi
# LENMONITOR_ADD_SERVERS_PER_5MIN
if [[ -n "$LENMONITOR_ADD_SERVERS_PER_5MIN" ]]; then
RUN_CMD="$RUN_CMD -add-servers-per-5min '$LENMONITOR_ADD_SERVERS_PER_5MIN'"
fi
# LENMONITOR_ADMIN_MAIL
if [[ -n "$LENMONITOR_ADMIN_NAME" ]]; then
RUN_CMD="$RUN_CMD -admin-name '$LENMONITOR_ADMIN_NAME'"
fi
# LENMONITOR_ADMIN_MAIL
if [[ -n "$LENMONITOR_ADMIN_MAIL" ]]; then
RUN_CMD="$RUN_CMD -admin-mail '$LENMONITOR_ADMIN_MAIL'"
fi
# Run Lenmonitor
echo "[ENTRYPOINT] $RUN_CMD"
sh -c "$RUN_CMD"