fix: preserve Zoraxy certs across greenfield destroy

This commit is contained in:
Claus Lohmar 2026-07-07 10:52:16 +01:00
parent eabbcdaa2d
commit acd9671359

View file

@ -49,11 +49,15 @@ if [ "$GREENFIELD" = true ]; then
chattr -R -i "$TARGET_DIR" 2>/dev/null || true
fi
# Preserve .env across greenfield destroy
# Preserve .env and Zoraxy certs across greenfield destroy
if [ -f "$TARGET_DIR/.env" ]; then
cp "$TARGET_DIR/.env" /tmp/nextworkspace.env.bak
echo "[INFO] Preserved .env"
fi
if [ -d "$TARGET_DIR/config/zoraxy/conf/certs" ]; then
cp -r "$TARGET_DIR/config/zoraxy" /tmp/nextworkspace.zoraxy.bak
echo "[INFO] Preserved Zoraxy config + certs"
fi
rm -rf "$TARGET_DIR"
@ -64,12 +68,17 @@ if [ "$GREENFIELD" = true ]; then
mkdir -p "$TARGET_DIR/compose"
mkdir -p "$TARGET_DIR/logs"
# Restore preserved .env
# Restore preserved .env and Zoraxy config+certs
if [ -f /tmp/nextworkspace.env.bak ]; then
mv /tmp/nextworkspace.env.bak "$TARGET_DIR/.env"
chmod 600 "$TARGET_DIR/.env"
echo "[INFO] Restored .env"
fi
if [ -d /tmp/nextworkspace.zoraxy.bak ]; then
cp -r /tmp/nextworkspace.zoraxy.bak/* "$TARGET_DIR/config/zoraxy/"
rm -rf /tmp/nextworkspace.zoraxy.bak
echo "[INFO] Restored Zoraxy config + certs"
fi
echo "[5/6] Copying binary..."
cp "$BINARY_NAME" "$TARGET_DIR/$BINARY_NAME"