diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..6e33b33 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e + +printf "########################################\n" +printf "# Container starting up!\n" +printf "########################################\n" + +# Check for WebDav user/pass +printf "# STATE: Checking for WebDav user/pass\n" +if [ -n "$WEBDAV_USER" ] && [ -n "$WEBDAV_PASS" ] +then + printf "# STATE: WebDav user/pass written to /etc/nginx/webdav_credentials\n" + htpasswd -b -c /etc/nginx/webdav_credentials $WEBDAV_USER $WEBDAV_PASS > /dev/null 2>&1 +else + printf "# WARN: No WebDav user/pass were set, the "restricted" directory has no authentication on it!\n" + sed -i "s/.*auth_basic.*//g" /etc/nginx/sites-enabled/webdav + sed -i "s/.*auth_basic_user_file.*//g" /etc/nginx/sites-enabled/webdav +fi + +# Check for client_max_body_size setting +if [ -n "$NGINX_CLIENT_MAX_BODY_SIZE" ] +then + printf "# STATE: Setting client_max_body_size to $NGINX_CLIENT_MAX_BODY_SIZE\n" + sed -i "s/client_max_body_size 250M;/client_max_body_size $NGINX_CLIENT_MAX_BODY_SIZE;/g" /etc/nginx/sites-enabled/webdav +fi + +printf "# STATE: Nginx is starting up now, the logs you see below are error_log and access_log from Nginx\n" +exec "$@" diff --git a/password.sh b/password.sh deleted file mode 100755 index 64e490b..0000000 --- a/password.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -e - -printf "#####\n" -printf "# Container starting up!\n" -printf "#####\n" - -# Check for WebDav user/pass -printf "# STATE: Checking for WebDav user/pass\n" -if [ -n "$WEBDAV_USER" ] && [ -n "$WEBDAV_PASS" ] -then - printf "# STATE: WebDav user/pass written to /etc/nginx/webdav_credentials\n" - htpasswd -b -c /etc/nginx/webdav_credentials $WEBDAV_USER $WEBDAV_PASS > /dev/null 2>&1 -else - printf "# WARN: No WebDav user/pass were set, the 'restricted' diretory has no authentication on it!\n" - sed -i 's/.*auth_basic.*//g' /etc/nginx/sites-enabled/webdav - sed -i 's/.*auth_basic_user_file.*//g' /etc/nginx/sites-enabled/webdav -fi - - -printf "# STATE: Nginx is starting up now, the logs you see below are error_log and access_log from Nginx\n" -exec "$@"