From 958b16eccf9f8677933e660cd8fcf76c4cc38ec6 Mon Sep 17 00:00:00 2001 From: "Mohammed A.Q" <65144622+mohammedalqadi@users.noreply.github.com> Date: Tue, 19 May 2020 03:42:37 +0000 Subject: [PATCH] Update run file to Waitress server to update with the recent changes from the project: - Change Flask server with waitress server - Added Basic user Authentication option - Added server Address option --- root/etc/services.d/whooglesearch/run | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/root/etc/services.d/whooglesearch/run b/root/etc/services.d/whooglesearch/run index bdfa07a..59b5aa8 100644 --- a/root/etc/services.d/whooglesearch/run +++ b/root/etc/services.d/whooglesearch/run @@ -1,8 +1,19 @@ #!/usr/bin/with-contenv bash -WEB_PORT=${WEB_PORT:-5000} +ADDRESS=${ADDRESS:-0.0.0.0} +EXPOSE_PORT=${EXPOSE_PORT:-5000} +USER=${USER} +PASSWORD=${PASSWORD} cd / -exec \ - s6-setuidgid abc flask run --host="0.0.0.0" --port="${WEB_PORT}" +# Create User Authentication if specified +if [ -z "${USER}" ] && [ -z "${PASSWORD}" ]; then + echo "No User and Password Will be set for Basic authentication" + exec \ + s6-setuidgid abc python3 -um app --host "${ADDRESS}" --port "${EXPOSE_PORT}" +else + echo "Setting Up Basic Authentication with Username="$USER" Password="$PASSWORD"" + exec \ + s6-setuidgid abc python3 -um app --host "${ADDRESS}" --port "${EXPOSE_PORT}" --userpass "$USER":"$PASSWORD" +fi