first commit
This commit is contained in:
37
start.sh
Executable file
37
start.sh
Executable 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
|
||||
Reference in New Issue
Block a user