Files
openclaw-workspace-2026/scripts/qdrant-api.sh
T
JC Beasley 6d2105d206 Implement Vault secret cache system
New scripts:
- vault-cache.sh: Main cache manager (sync/get/list/status/invalidate)
- vault-env.sh: Sourceable environment with quick accessor functions
- vault-api-cached.sh: Drop-in replacement for vault_api.sh using cache
- nocodb-api.sh: NocoDB API wrapper using cached token
- qdrant-api.sh: Qdrant API wrapper using cached key
- README-vault-cache.md: Documentation

Updated scripts:
- vault_grist_api.sh: Now uses vault cache
- checks/check-memory-table.sh: Uses vault cache
- utils/get-columns.sh: Uses vault cache
- utils/update-type-col.sh: Uses vault cache

Features:
- 29 secrets cached from Vault (6 categories)
- Auto-refresh on stale entries (1hr TTL)
- Vault token cached for 24h
- Restricted permissions (700/600) on cache files
- Fallback to direct Vault API if cache miss
2026-07-19 08:57:13 -07:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# qdrant-api.sh - Qdrant API wrapper using vault cache
# Usage: source this file or call its functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/vault-env.sh"
QDRANT_URL=$(vault_qdrant_url)
QDRANT_API_KEY=$(vault_qdrant_api_key)
if [ -z "$QDRANT_API_KEY" ]; then
echo "Error: Could not retrieve Qdrant API key from vault cache"
return 1 2>/dev/null || exit 1
fi
# Make Qdrant API calls
qdrant_api() {
local method="${1:-GET}"
local endpoint="$2"
local payload="${3:-}"
local headers=(-H "api-key: ${QDRANT_API_KEY}" -H "Content-Type: application/json")
if [ "$method" = "GET" ]; then
curl -sk "${headers[@]}" "${QDRANT_URL}${endpoint}"
else
curl -sk -X "$method" "${headers[@]}" -d "$payload" "${QDRANT_URL}${endpoint}"
fi
}
# Common operations
qdrant_list_collections() {
qdrant_api GET "/collections"
}
qdrant_collection_info() {
local collection="${1:-}"
[ -z "$collection" ] && { echo "Usage: qdrant_collection_info <collection_name>"; return 1; }
qdrant_api GET "/collections/${collection}"
}
# Export
export -f qdrant_api qdrant_list_collections qdrant_collection_info
export QDRANT_URL QDRANT_API_KEY