mirror of
https://github.com/R0m1k3/PleinR.git
synced 2026-10-21 22:28:04 +02:00
Rend AUTH_SECRET optionnel : génération auto + persistance au déploiement
Le compose ne requiert plus AUTH_SECRET (`:?` retiré). Si la variable est vide, docker-entrypoint.sh génère un secret aléatoire et le persiste dans le volume app-data (/app/data/auth_secret), réutilisé aux redémarrages. Surcharge possible en définissant AUTH_SECRET. Déploiement Portainer sans configuration requise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XwfhYHzC9hQWPDnQ2p53GL
This commit is contained in:
5 files changed
+30
-6
No files matched your search
@@ -1,6 +1,21 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Ensure an AUTH_SECRET exists. If none is provided, generate one and persist it
|
||||
# to the app-data volume so sessions stay valid across restarts.
|
||||
if [ -z "$AUTH_SECRET" ]; then
|
||||
SECRET_FILE=/app/data/auth_secret
|
||||
if [ -f "$SECRET_FILE" ]; then
|
||||
AUTH_SECRET=$(cat "$SECRET_FILE")
|
||||
else
|
||||
AUTH_SECRET=$(node -e "console.log(require('crypto').randomBytes(32).toString('base64'))")
|
||||
mkdir -p /app/data
|
||||
printf '%s' "$AUTH_SECRET" > "$SECRET_FILE"
|
||||
echo "→ AUTH_SECRET généré et persisté dans $SECRET_FILE"
|
||||
fi
|
||||
export AUTH_SECRET
|
||||
fi
|
||||
|
||||
echo "→ Applying database migrations…"
|
||||
node dist/migrate.cjs
|
||||
|
||||
|
||||
Reference in new issue
Block a user