#!/bin/bash
# Uses vault cache for fast token retrieval

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/../vault-env.sh"

NOCODB_TOKEN=$(vaul…ken)

if [ -z "$NOCODB_TOKEN" ]; then
    echo "Error: Could not retrieve NocoDB token"
    exit 1
fi

# Get vault token
# Get nocodb token
echo "NocoDB Token: ${NOCODB_TOKEN:0:20}..."
# Get column ID for 'type'
echo "=== Getting type column ID ==="
curl -s "http://192.168.25.5:8080/api/v2/meta/tables/mx149yctebfwvys" \
  -H "xc-token: $NOCODB_TOKEN" | jq '.columns[] | select(.column_name == "type") | {id, column_name, uidt}'
