refactor(update-backend): streamline .env file handling process
Some checks failed
Deploy to production / deploy (push) Failing after 1m58s
Some checks failed
Deploy to production / deploy (push) Failing after 1m58s
- Replaced the previous method of copying .env files with a direct installation from a specified source path. - Improved permissions and ownership settings for the .env file to enhance security. - Added user feedback for successful file transfer and verification steps.
This commit is contained in:
@@ -1933,6 +1933,8 @@ export default class VocabService {
|
|||||||
|
|
||||||
if (correctIndices.length === 0) return false;
|
if (correctIndices.length === 0) return false;
|
||||||
|
|
||||||
|
const options = Array.isArray(parsedQuestionData?.options) ? parsedQuestionData.options : [];
|
||||||
|
|
||||||
const correctTexts = correctIndices
|
const correctTexts = correctIndices
|
||||||
.map((i) => options[i])
|
.map((i) => options[i])
|
||||||
.filter((opt) => opt !== undefined && opt !== null);
|
.filter((opt) => opt !== undefined && opt !== null);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"loading": "Lädt...",
|
"loading": "Lädt...",
|
||||||
"back": "Zurück",
|
"back": "Zurück",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
|
"ok": "OK",
|
||||||
"yes": "Ja",
|
"yes": "Ja",
|
||||||
"no": "Nein"
|
"no": "Nein"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"loading": "Loading...",
|
"loading": "Loading...",
|
||||||
"back": "Back",
|
"back": "Back",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
|
"ok": "OK",
|
||||||
"yes": "Yes",
|
"yes": "Yes",
|
||||||
"no": "No"
|
"no": "No"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"loading": "Cargando...",
|
"loading": "Cargando...",
|
||||||
"back": "Atrás",
|
"back": "Atrás",
|
||||||
"cancel": "Cancelar",
|
"cancel": "Cancelar",
|
||||||
|
"ok": "Aceptar",
|
||||||
"yes": "Sí",
|
"yes": "Sí",
|
||||||
"no": "No"
|
"no": "No"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -25,27 +25,21 @@ echo "Installing dependencies..."
|
|||||||
npm ci --production
|
npm ci --production
|
||||||
|
|
||||||
echo "Übernehme .env-Dateien vom Live-System..."
|
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-$$"
|
SOURCE_ENV="/opt/yourpart/backend/.env"
|
||||||
mkdir -p "$TEMP_ENV_DIR"
|
TARGET_ENV="$BACKEND_DIR/.env"
|
||||||
|
|
||||||
echo "Sichere .env-Dateien aus $CURRENT_BACKEND..."
|
echo "Quelle: $SOURCE_ENV"
|
||||||
if [ -d "$CURRENT_BACKEND" ]; then
|
echo "Ziel: $TARGET_ENV"
|
||||||
find "$CURRENT_BACKEND" -maxdepth 1 -name '.env*' -type f -exec cp {} "$TEMP_ENV_DIR/" \; 2>/dev/null || true
|
|
||||||
if [ "$(ls -A "$TEMP_ENV_DIR" 2>/dev/null)" ]; then
|
sudo -n ls -l "$SOURCE_ENV"
|
||||||
echo "✓ .env-Dateien gesichert: $(ls "$TEMP_ENV_DIR")"
|
sudo -n install -m 600 -o yourpart -g yourpart "$SOURCE_ENV" "$TARGET_ENV"
|
||||||
cp "$TEMP_ENV_DIR"/.env* "$BACKEND_DIR"/ 2>/dev/null || true
|
|
||||||
else
|
echo "Prüfe kopierte Datei..."
|
||||||
echo "⚠ Keine .env-Dateien in $CURRENT_BACKEND gefunden"
|
ls -l "$TARGET_ENV"
|
||||||
fi
|
sudo -n head -n 1 "$TARGET_ENV" >/dev/null
|
||||||
fi
|
|
||||||
|
echo "✓ .env-Datei wurde übernommen"
|
||||||
|
|
||||||
sudo -n mkdir -p "$DATA_DIR/adult-verification"
|
sudo -n mkdir -p "$DATA_DIR/adult-verification"
|
||||||
|
|
||||||
@@ -61,10 +55,6 @@ sudo -n chmod -R 755 "$BACKEND_DIR"
|
|||||||
sudo -n chown -R yourpart:yourpart "$DATA_DIR"
|
sudo -n chown -R yourpart:yourpart "$DATA_DIR"
|
||||||
sudo -n chmod -R 755 "$DATA_DIR"
|
sudo -n chmod -R 755 "$DATA_DIR"
|
||||||
|
|
||||||
if [ -f "$BACKEND_DIR/.env" ]; then
|
|
||||||
sudo -n chmod 600 "$BACKEND_DIR/.env"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Updating systemd service..."
|
echo "Updating systemd service..."
|
||||||
sudo -n cp "$TARGET_DIR/yourpart.service" /etc/systemd/system/
|
sudo -n cp "$TARGET_DIR/yourpart.service" /etc/systemd/system/
|
||||||
sudo -n systemctl daemon-reload
|
sudo -n systemctl daemon-reload
|
||||||
|
|||||||
Reference in New Issue
Block a user