mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
0137f009d4
- Add --external better-sqlite3 to tsup build to fix ESM runtime error - Add docker-entrypoint.sh to auto-generate BETTER_AUTH_SECRET if not set - Persist generated secret to /data/.auth_secret across restarts - Move image-based compose files to deploy/ directory - Add deploy/docker-compose.rustfs.yml for ZPan + RustFS setup - Keep build-from-source docker-compose.yml at project root Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
18 lines
497 B
Bash
Executable File
18 lines
497 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Auto-generate BETTER_AUTH_SECRET if not provided
|
|
if [ -z "$BETTER_AUTH_SECRET" ]; then
|
|
SECRET_FILE="/data/.auth_secret"
|
|
if [ -f "$SECRET_FILE" ]; then
|
|
BETTER_AUTH_SECRET=$(cat "$SECRET_FILE")
|
|
else
|
|
BETTER_AUTH_SECRET=$(node -e "console.log(require('crypto').randomBytes(32).toString('base64'))")
|
|
printf '%s' "$BETTER_AUTH_SECRET" > "$SECRET_FILE"
|
|
echo "Generated BETTER_AUTH_SECRET and saved to $SECRET_FILE"
|
|
fi
|
|
export BETTER_AUTH_SECRET
|
|
fi
|
|
|
|
exec "$@"
|