diff --git a/auth_django.py b/auth_django.py index d3e86cf..94abc5d 100755 --- a/auth_django.py +++ b/auth_django.py @@ -5,12 +5,15 @@ import sys import django -LOG_PATH = "auth_debug.log" +LOG_PATH = os.environ.get("AUTH_DEBUG_LOG", "/tmp/auth_debug.log") def log(data): - with open(LOG_PATH, "a") as f: - f.write(f"{data}\n") + try: + with open(LOG_PATH, "a") as f: + f.write(f"{data}\n") + except Exception: + pass # Set up Django environment diff --git a/auth_django.sh b/auth_django.sh index e2d71a5..5857a4d 100755 --- a/auth_django.sh +++ b/auth_django.sh @@ -1,13 +1,10 @@ #!/bin/sh -podman exec -i gia sh -c "cd /code && . /venv/bin/activate && python auth_django.py" -#cd /code -#. /code/xf/GIA/genv/bin/activate -#exec python /code/xf/GIA/auth_django.py +set -eu - -set -e -podman exec -i gia sh -c ' +# Prosody external auth expects a single long-lived stdin/stdout process. +# Keep one stable process chain and hand off with exec. +exec podman exec -i gia sh -lc ' cd /code && . /venv/bin/activate && - exec python auth_django.py + exec python -u auth_django.py '