pass secret into inherited vars

This commit is contained in:
dekzter 2025-12-06 12:45:05 -05:00
parent c0166bbfe9
commit 1456211a4e
2 changed files with 12 additions and 11 deletions

View file

@ -82,6 +82,16 @@ echo "Environment DISPATCHARR_LOG_LEVEL set to: '${DISPATCHARR_LOG_LEVEL}'"
# READ-ONLY - don't let users change these
export POSTGRES_DIR=/data/db
# Run init scripts
echo "Starting user setup..."
. /app/docker/init/01-user-setup.sh
echo "Setting up PostgreSQL..."
. /app/docker/init/02-postgres.sh
echo "Starting init process..."
. /app/docker/init/03-init-dispatcharr.sh
export DJANGO_SECRET_KEY="$(cat "$SECRET_FILE")"
# Global variables, stored so other users inherit them
if [[ ! -f /etc/profile.d/dispatcharr.sh ]]; then
# Define all variables to process
@ -91,7 +101,7 @@ if [[ ! -f /etc/profile.d/dispatcharr.sh ]]; then
DISPATCHARR_ENV DISPATCHARR_DEBUG DISPATCHARR_LOG_LEVEL
REDIS_HOST REDIS_DB POSTGRES_DIR DISPATCHARR_PORT
DISPATCHARR_VERSION DISPATCHARR_TIMESTAMP LIBVA_DRIVERS_PATH LIBVA_DRIVER_NAME LD_LIBRARY_PATH
CELERY_NICE_LEVEL UWSGI_NICE_LEVEL
CELERY_NICE_LEVEL UWSGI_NICE_LEVEL DJANGO_SECRET_KEY
)
# Process each variable for both profile.d and environment
@ -121,16 +131,6 @@ fi
EOF
fi
# Run init scripts
echo "Starting user setup..."
. /app/docker/init/01-user-setup.sh
echo "Setting up PostgreSQL..."
. /app/docker/init/02-postgres.sh
echo "Starting init process..."
. /app/docker/init/03-init-dispatcharr.sh
export DJANGO_SECRET_KEY="$(cat "$SECRET_FILE")"
# Start PostgreSQL
echo "Starting Postgres..."
su - postgres -c "$PG_BINDIR/pg_ctl -D ${POSTGRES_DIR} start -w -t 300 -o '-c port=${POSTGRES_PORT}'"

View file

@ -40,6 +40,7 @@ PY
mv -f "$tmpfile" "$SECRET_FILE" || { echo "move failed"; rm -f "$tmpfile"; exit 1; }
fi
chown $PUID:$PGID "$SECRET_FILE" || true
chmod 600 "$SECRET_FILE" || true
# Export for app start (read the file)