#!/bin/bash
source "${AGENT_PATH}/_common.sh"
_check_required_env_vars "LOCAL_DATA_FOLDER"

# Nginx Example Restore Script

BACKUP_FILE="$1"

echo "Uninstalling service before restore..."
bash ./uninstall.sh || _die "Failed to uninstall service before restore"

autorestore "path=${LOCAL_DATA_FOLDER}" $1 $2 || _die "Failed to restore data folder from backup"

echo "Restore complete. Reinstalling service..."
bash ./install.sh || _die "Failed to reinstall service after restore"

echo "Service ${CONTAINER_NAME} restored and reinstalled."
