#!/bin/bash
# ⚠️ ЗАМЕНИТЕ НА ВАШИ КЛЮЧИ!
UNSEAL_KEY_1="gj3nTOOvpPhwGAHIF9Aqn3yItMhhpUCIdwoyi436SI7r"
UNSEAL_KEY_2="MyOsPq18ycRyIeYz8clOyYY8OOiANqQPm1GgdALNDrsh"
UNSEAL_KEY_3="kUO0g05tXfgcUxLSBav6UTYybD8KtiO/Ea0ckDBP4rW5"

echo "Checking Vault..."
STATUS=$(docker exec vault vault status -format=json 2>/dev/null | jq -r '.sealed')

if [ "$STATUS" == "true" ]; then
    echo "Unsealing Vault..."
    docker exec vault vault operator unseal "$UNSEAL_KEY_1"
    docker exec vault vault operator unseal "$UNSEAL_KEY_2"
    docker exec vault vault operator unseal "$UNSEAL_KEY_3"
    echo "✅ Vault unsealed"
else
    echo "✅ Vault already unsealed"
fi
