#!/usr/bin/env bash . ./scripts/util.sh [[ -s "tmp/dev-user/vars.sh" ]] || { if [[ -n "$IS_DOCKER" ]]; then fail "can't find a running server on this image. use \`docker compose up app\` and then \`docker compose exec app $0\`" else fail "server is not running with dev user enabled" fi } set -a . ./tmp/dev-user/vars.sh set +a check-exe curl "curl not found" get() { local path="$1"; shift execd curl -k \ -H "Accept: application/json" \ -H "Authorization: Bearer $OCW_TOKEN" \ https://"$OCW_ADDRESS"/api/"$path" } websocket() { wscat -w 6000 -x "$OCW_TOKEN" -n -c wss://"$OCW_ADDRESS"/api/live } usage() { cat <&2 usage: $0 get some/path $0 websocket DOC } cmd="$1"; shift case cmd in get) get "$@" ;; websocket|ws) websocket "$@" ;; *) get "$cmd" "$@" esac