From 24904fcc27ccba96dfa13245f8eb3add096b36dd Mon Sep 17 00:00:00 2001 From: centerionware Date: Thu, 3 Oct 2024 05:47:10 +0000 Subject: [PATCH] feat: Add debugpy as optional to entrypoint script if DEBUG env variable is set to anything. --- entrypoint.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 63845092..604326a4 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -76,7 +76,16 @@ echo "Container Initialization complete." echo "Starting Riven (Backend)..." if [ "$PUID" = "0" ]; then - cd /riven/src && poetry run python3 main.py + if [ "${DEBUG}" != "" ]; then # check if DEBUG is set to a truthy value + cd /riven/src && poetry add debugpy && poetry run python3 -m debugpy --listen 0.0.0.0:5678 main.py + else + cd /riven/src && poetry run python3 main.py + fi else - su -m "$USERNAME" -c "cd /riven/src && poetry run python3 main.py" + if [ "${DEBUG}" != "" ]; then # check if DEBUG is set to a truthy value + poetry add debugpy + exec su -m $USERNAME -c "cd /riven/src && poetry run python3 -m debugpy --listen 0.0.0.0:5678 main.py" + else + su -m "$USERNAME" -c "cd /riven/src && poetry run python3 main.py" + fi fi \ No newline at end of file