diff --git a/boot.sh b/boot.sh index 91b436f7..313fbd42 100644 --- a/boot.sh +++ b/boot.sh @@ -4,11 +4,26 @@ source venv/bin/activate TANDOOR_PORT="${TANDOOR_PORT:-8080}" NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf +display_warning() { + echo "[WARNING]" + echo -e "$1" +} + echo "Checking configuration..." +# Nginx config file must exist if gunicorn is not active if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -eq 0 ]; then - echo -e "\n[WARNING]\nNginx configuration file could not be found at the default location!" - echo -e "Path: ${NGINX_CONF_FILE}\n" + display_warning "Nginx configuration file could not be found at the default location!\nPath: ${NGINX_CONF_FILE}" +fi + +# SECRET_KEY must be set in .env file +if [ -z "${SECRET_KEY}" ]; then + display_warning "The environment variable 'SECRET_KEY' is not set but REQUIRED for running Tandoor!" +fi + +# POSTGRES_PASSWORD must be set in .env file +if [ -z "${POSTGRES_PASSWORD}" ]; then + display_warning "The environment variable 'POSTGRES_PASSWORD' is not set but REQUIRED for running Tandoor!" fi echo "Waiting for database to be ready..." @@ -43,4 +58,4 @@ echo "Done" chmod -R 755 /opt/recipes/mediafiles -exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi +exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi \ No newline at end of file