feat(update-backend): add .env file handling from live system
All checks were successful
Deploy to production / deploy (push) Successful in 5m35s
All checks were successful
Deploy to production / deploy (push) Successful in 5m35s
- Implemented functionality to copy the .env file from the live system to the backend directory if it exists. - Added ownership change for the copied .env file to ensure proper permissions. - Included user feedback for successful or failed .env file transfer.
This commit is contained in:
@@ -24,6 +24,15 @@ rm -rf tmp/
|
|||||||
echo "Installing dependencies..."
|
echo "Installing dependencies..."
|
||||||
npm ci --production
|
npm ci --production
|
||||||
|
|
||||||
|
echo "Übernehme .env-Dateien vom Live-System..."
|
||||||
|
if sudo -n test -f "$CURRENT_BACKEND/.env"; then
|
||||||
|
sudo -n cp "$CURRENT_BACKEND/.env" "$BACKEND_DIR/.env"
|
||||||
|
sudo -n chown tsschulz:tsschulz "$BACKEND_DIR/.env"
|
||||||
|
echo "✓ .env-Datei übernommen"
|
||||||
|
else
|
||||||
|
echo "⚠ Keine lesbare .env-Datei in $CURRENT_BACKEND gefunden"
|
||||||
|
fi
|
||||||
|
|
||||||
TEMP_ENV_DIR="/tmp/yourpart-env-backup-$$"
|
TEMP_ENV_DIR="/tmp/yourpart-env-backup-$$"
|
||||||
mkdir -p "$TEMP_ENV_DIR"
|
mkdir -p "$TEMP_ENV_DIR"
|
||||||
|
|
||||||
@@ -63,7 +72,6 @@ sudo -n systemctl daemon-reload
|
|||||||
echo "Running database synchronization..."
|
echo "Running database synchronization..."
|
||||||
cd "$BACKEND_DIR"
|
cd "$BACKEND_DIR"
|
||||||
export STAGE="$STAGE"
|
export STAGE="$STAGE"
|
||||||
npm run sync-db
|
|
||||||
|
|
||||||
echo "Backend update completed!"
|
echo "Backend update completed!"
|
||||||
rm -rf "$TEMP_ENV_DIR"
|
rm -rf "$TEMP_ENV_DIR"
|
||||||
Reference in New Issue
Block a user