17 lines
380 B
Bash
Executable File
17 lines
380 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
if out="$(curl \
|
|
--no-progress-meter \
|
|
--fail-with-body \
|
|
-H "Authorization: Bearer ${VULTR_API_KEY:-$(cat secrets/vultr-api-key.txt)}" \
|
|
-H "Content-Type: application/json" \
|
|
"https://api.vultr.com/v2/$@")"
|
|
then
|
|
printf '%s\n' "$out"
|
|
else
|
|
jq <<<"$out" >&2
|
|
return 1
|
|
fi
|