Skip to content

Commit

Permalink
feat: Allow configuring HTTP_PORT and HTTP_WORKERS
Browse files Browse the repository at this point in the history
  • Loading branch information
bjw-s authored and Bnyro committed Jan 14, 2025
1 parent 1b5a362 commit e752a85
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
#!/bin/sh

if [ -z "$BACKEND_HOSTNAME" ]; then
if [ -z "${BACKEND_HOSTNAME}" ]; then
echo "BACKEND_HOSTNAME not set"
exit 1
fi

HTTP_MODE=${HTTP_MODE:-https}

sed -i s@https://pipedapi.kavin.rocks@"$HTTP_MODE"://pipedapi.kavin.rocks@g /usr/share/nginx/html/assets/*
sed -i s/pipedapi.kavin.rocks/"$BACKEND_HOSTNAME"/g /usr/share/nginx/html/assets/*
sed -i "s@https://pipedapi.kavin.rocks@${HTTP_MODE}://pipedapi.kavin.rocks@g" /usr/share/nginx/html/assets/*
sed -i "s/pipedapi.kavin.rocks/${BACKEND_HOSTNAME}/g" /usr/share/nginx/html/assets/*

if [ -n "${HTTP_WORKERS}" ]; then
sed -i "s/worker_processes auto;/worker_processes ${HTTP_WORKERS};/g" /etc/nginx/nginx.conf
fi

if [ -n "${HTTP_PORT}" ]; then
sed -i "s/80;/${HTTP_PORT};/g" /etc/nginx/conf.d/default.conf
fi

nginx -g "daemon off;"

0 comments on commit e752a85

Please sign in to comment.