diff --git a/scripts/lib/restoration.fish b/scripts/lib/restoration.fish index d85707f9..3e40056e 100644 --- a/scripts/lib/restoration.fish +++ b/scripts/lib/restoration.fish @@ -37,12 +37,6 @@ function initBackupConfig -V dir -d "Fetches the configuration by prompting the "Please specify the path to the directory to load the backup from: " \ "Please specify the path to the backup directory: " - if [ -z "$$keyVar" ] - set -gx "$keyVar" "$keyPath" - sudo mkdir -p (dirname "$keyPath") - sudo ssh-keygen -f "$$keyVar" -N "" - end - if $confirm $ssh[$index] n read -gxP $server[$index] VALHALLA_BACKUP_SERVER read -gxP $port[$index] VALHALLA_BACKUP_SERVER_PORT @@ -52,6 +46,12 @@ function initBackupConfig -V dir -d "Fetches the configuration by prompting the if [ -n "$VALHALLA_BACKUP_SERVER" ] set -l sshArgs + if [ -z "$$keyVar" ] + set -gx "$keyVar" "$keyPath" + sudo mkdir -p (dirname "$keyPath") + sudo ssh-keygen -f "$$keyVar" -N "" + end + if [ -n "$VALHALLA_BACKUP_SERVER_PORT" ] set -a sshArgs -p "$VALHALLA_BACKUP_SERVER_PORT" end