fix: auto-generate encryption keys in Railway startup script

This commit is contained in:
tinkle-community
2026-01-06 17:59:29 +08:00
parent 4804cfcb05
commit 7db37ade1c
3 changed files with 25 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Backend startup wrapper - generates encryption keys if not set
# Generate RSA private key if not set
if [ -z "$RSA_PRIVATE_KEY" ]; then
echo "🔐 Generating RSA key pair..."
export RSA_PRIVATE_KEY=$(openssl genrsa 2048 2>/dev/null)
echo "✅ RSA key generated"
fi
# Generate data encryption key if not set
if [ -z "$DATA_ENCRYPTION_KEY" ]; then
echo "🔐 Generating data encryption key..."
export DATA_ENCRYPTION_KEY=$(openssl rand -base64 32)
echo "✅ Data encryption key generated"
fi
# Start the backend
exec /app/nofx
+1 -1
View File
@@ -5,7 +5,7 @@ logfile_maxbytes=0
pidfile=/tmp/supervisord.pid
[program:backend]
command=/app/nofx
command=/app/start-backend.sh
directory=/app
autostart=true
autorestart=true