Skip to content

Commit 1ecb5bb

Browse files
CopilotMickLesk
andauthored
Add DJANGO_SECRET_KEY support for Dispatcharr v0.13.1+ (#9730)
* Initial plan * Add DJANGO_SECRET_KEY support for Dispatcharr v0.13.1+ Co-authored-by: MickLesk <[email protected]> * Improve DJANGO_SECRET_KEY generation to ensure consistent 50 character length Co-authored-by: MickLesk <[email protected]> * short --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: MickLesk <[email protected]>
1 parent 64dbd4e commit 1ecb5bb

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ct/dispatcharr.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ function update_script() {
8787
mv /tmp/start-daphne.sh.backup /opt/dispatcharr/start-daphne.sh
8888
fi
8989

90+
if ! grep -q "DJANGO_SECRET_KEY" /opt/dispatcharr/.env; then
91+
DJANGO_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
92+
echo "DJANGO_SECRET_KEY=$DJANGO_SECRET" >> /opt/dispatcharr/.env
93+
fi
94+
9095
cd /opt/dispatcharr
9196
rm -rf .venv
9297
$STD uv venv

install/dispatcharr-install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ install -d -m 755 \
6262
/data/uploads/{m3us,epgs} \
6363
/data/{m3us,epgs}
6464
chown -R root:root /data
65+
DJANGO_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
6566
export DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
6667
export POSTGRES_DB=$DB_NAME
6768
export POSTGRES_USER=$DB_USER
6869
export POSTGRES_PASSWORD=$DB_PASS
6970
export POSTGRES_HOST=localhost
71+
export DJANGO_SECRET_KEY=$DJANGO_SECRET
7072
$STD uv run python manage.py migrate --noinput
7173
$STD uv run python manage.py collectstatic --noinput
7274
cat <<EOF >/opt/dispatcharr/.env
@@ -76,6 +78,7 @@ POSTGRES_USER=$DB_USER
7678
POSTGRES_PASSWORD=$DB_PASS
7779
POSTGRES_HOST=localhost
7880
CELERY_BROKER_URL=redis://localhost:6379/0
81+
DJANGO_SECRET_KEY=$DJANGO_SECRET
7982
EOF
8083
cd /opt/dispatcharr/frontend
8184
$STD npm install --legacy-peer-deps

0 commit comments

Comments
 (0)