#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=../lib/common.sh
source "${ROOT}/lib/common.sh"

require_env TOKEN
NAME="${API_KEY_NAME:-example-key}"

curl_post_bearer_json "/api-key/create" "${TOKEN}" \
  "$(printf '%s' "{\"name\":\"${NAME}\"}")" | pretty
