Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.1 KiB
Bash
Executable File
35 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Call UniFi Network API /sites using API key from dotenv.
|
|
# Usage: ./scripts/unifi/curl-sites.sh or bash scripts/unifi/curl-sites.sh
|
|
# Loads UNIFI_UDM_URL and UNIFI_API_KEY from .env, unifi-api/.env, or ~/.env.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
cd "$PROJECT_ROOT"
|
|
|
|
# Load UNIFI_* from repo .env, unifi-api/.env, or ~/.env (later overrides)
|
|
if [ -f "$PROJECT_ROOT/.env" ]; then
|
|
set -a && source "$PROJECT_ROOT/.env" 2>/dev/null && set +a
|
|
fi
|
|
if [ -f "$PROJECT_ROOT/unifi-api/.env" ]; then
|
|
set -a && source "$PROJECT_ROOT/unifi-api/.env" 2>/dev/null && set +a
|
|
fi
|
|
if [ -f ~/.env ]; then
|
|
source <(grep -E '^UNIFI_' ~/.env 2>/dev/null | sed 's/^/export /') 2>/dev/null || true
|
|
fi
|
|
|
|
UDM_URL="${UNIFI_UDM_URL:-https://192.168.0.1}"
|
|
API_KEY="${UNIFI_API_KEY:-}"
|
|
|
|
if [ -z "$API_KEY" ]; then
|
|
echo "UNIFI_API_KEY is not set. Add it to .env, unifi-api/.env, or ~/.env (see .env.example UNIFI_* section)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
curl -k -s -X GET "$UDM_URL/proxy/network/integration/v1/sites" \
|
|
-H "X-API-KEY: $API_KEY" \
|
|
-H "Accept: application/json" \
|
|
"$@"
|