Skip to content

Commit

Permalink
close #717/dep updates/improve TZ regex
Browse files Browse the repository at this point in the history
Signed-off-by: Zoey <[email protected]>
  • Loading branch information
renovate[bot] authored and Zoey2936 committed Mar 25, 2024
1 parent 5af9f19 commit ef5ac4c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
ARG CRS_VER=v4.1.0

COPY rootfs /
COPY --from=zoeyvid/certbot-docker:26 /usr/local /usr/local
COPY --from=zoeyvid/curl-quic:375 /usr/local/bin/curl /usr/local/bin/curl
COPY --from=zoeyvid/certbot-docker:27 /usr/local /usr/local
COPY --from=zoeyvid/curl-quic:376 /usr/local/bin/curl /usr/local/bin/curl

RUN apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates tzdata tini \
Expand Down Expand Up @@ -127,6 +127,7 @@ ENV PUID=0 \
DISABLE_H3_QUIC=false \
NGINX_ACCESS_LOG=false \
NGINX_LOG_NOT_FOUND=false \
NGINX_404_REDIRECT=true \
NGINX_DISABLE_PROXY_BUFFERING=false \
CLEAN=true \
FULLCLEAN=false \
Expand Down
3 changes: 2 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ services:
# - "DISABLE_HTTP=true" # disables nginx to listen on port 80, default false
# - "DISABLE_H3_QUIC=true" # disables nginx to listen on port 443 udp for default and your hosts, this will disable HTTP/3 and QUIC, default false
# - "NGINX_LOG_NOT_FOUND=true" # Allow logging of 404 errors, default false
# - "NGINX_DISABLE_PROXY_BUFFERING=true" # Disabled the proxy-buffering option of nginx, default false
# - "NGINX_404_REDIRECT=false" # Redirect to / instead of showing a 404 error page, default true
# - "NGINX_DISABLE_PROXY_BUFFERING=true" # Disables the proxy-buffering option of nginx, default false
# - "CLEAN=false" # Clean folders, default true
# - "FULLCLEAN=true" # Clean unused config folders, default false
# - "SKIP_IP_RANGES=true" # Skip feteching/whitelisting ip ranges from aws and cloudflare, default false
Expand Down
20 changes: 18 additions & 2 deletions rootfs/usr/local/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ if [ -n "$NPM_CERT_ID" ] && [ -z "$DEFAULT_CERT_ID" ]; then
export DEFAULT_CERT_ID="$NPM_CERT_ID"
fi

if [ -n "$NPM_CERT_ID" ] && [ -n "$DEFAULT_CERT_ID" ]; then
echo "You've set DEFAULT_CERT_ID, but didn't removed NPM_CERT_ID, please remove it."
sleep inf
fi


if [ -z "$TZ" ] || ! echo "$TZ" | grep -q "^[A-Za-z0-9/_+-]\+$"; then
echo "TZ is unset or invalid, it can consist of lower and upper letters a-z A-Z, numbers 0-9, slashes, underscores, plus and minus signs."
if [ -z "$TZ" ] || ! echo "$TZ" | grep -q "^[A-Za-z0-9_+-]\+/[A-Za-z0-9_+-]\+$"; then
echo "TZ is unset or invalid, it can consist of lower and upper letters a-z A-Z, numbers 0-9, underscores, plus and minus signs which are split by a slash."
sleep inf
fi

Expand Down Expand Up @@ -141,6 +146,11 @@ if ! echo "$NGINX_LOG_NOT_FOUND" | grep -q "^true$\|^false$"; then
sleep inf
fi

if ! echo "$NGINX_404_REDIRECT" | grep -q "^true$\|^false$"; then
echo "NGINX_404_REDIRECT needs to be true or false."
sleep inf
fi

if ! echo "$NGINX_DISABLE_PROXY_BUFFERING" | grep -q "^true$\|^false$"; then
echo "NGINX_DISABLE_PROXY_BUFFERING needs to be true or false."
sleep inf
Expand Down Expand Up @@ -806,6 +816,12 @@ else
sed -i "s|log_not_found.*|log_not_found off;|g" /usr/local/nginx/conf/nginx.conf
fi

if [ "$NGINX_404_REDIRECT" = "true" ]; then
sed -i "s|#error_page 404|error_page 404|g" /usr/local/nginx/conf/nginx.conf
else
sed -i "s|error_page 404|#error_page 404|g" /usr/local/nginx/conf/nginx.conf
fi

if [ "$NGINX_DISABLE_PROXY_BUFFERING" = "true" ]; then
sed -i "s|proxy_buffering.*|proxy_buffering off;|g" /usr/local/nginx/conf/nginx.conf
else
Expand Down

0 comments on commit ef5ac4c

Please sign in to comment.