first commit

This commit is contained in:
Mateusz Gruszczyński
2026-02-17 09:04:09 +01:00
commit c0afc1554d
32 changed files with 7217 additions and 0 deletions

37
start.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
set -e
if [ -f /opt/geoip_block_generator/.env ]; then
echo "Loading environment from .env..."
while IFS='=' read -r key value || [ -n "$key" ]; do
[[ "$key" =~ ^[[:space:]]*# ]] && continue
[[ -z "$key" ]] && continue
key=$(echo "$key" | xargs)
value=$(echo "$value" | xargs)
if [[ "$value" =~ ^\"(.*)\"$ ]]; then
value="${BASH_REMATCH[1]}"
elif [[ "$value" =~ ^\'(.*)\'$ ]]; then
value="${BASH_REMATCH[1]}"
fi
export "$key=$value"
done < /opt/geoip_block_generator/.env
fi
# Defaults
FLASK_HOST=${FLASK_HOST:-127.0.0.1}
FLASK_PORT=${FLASK_PORT:-5000}
# Start gunicorn
exec /opt/geoip_block_generator/venv/bin/gunicorn \
--bind "${FLASK_HOST}:${FLASK_PORT}" \
--workers 1 \
--threads 8 \
--worker-class sync \
--timeout 900 \
--access-logfile /var/log/geoip-ban/access.log \
--error-logfile /var/log/geoip-ban/error.log \
app:app