43fe443574
- README + CLAUDE.md: server access, API usage, conventions - docs/server.md: specs and core stack (Dokploy v0.29.7, Traefik, Swarm) - docs/inventory.md: deployed apps, starting with httpbin - scripts/api.sh: Dokploy API wrapper Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
29 lines
814 B
Bash
Executable File
29 lines
814 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Thin wrapper around the Dokploy API.
|
|
#
|
|
# Usage:
|
|
# scripts/api.sh project.all
|
|
# scripts/api.sh application.one applicationId=q_TboJiWsBtn6PRD3BfIO
|
|
# scripts/api.sh application.deploy '{"applicationId":"..."}'
|
|
#
|
|
# GET when the arg looks like key=value query params (or none); POST when given JSON.
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
set -a; source .env; set +a
|
|
|
|
endpoint="$1"; shift || true
|
|
|
|
if [[ $# -gt 0 && $1 == \{* ]]; then
|
|
curl -s --fail-with-body -X POST \
|
|
-H "x-api-key: $DOKPLOY_API_KEY" -H "Content-Type: application/json" \
|
|
"$DOKPLOY_URL/api/$endpoint" -d "$1"
|
|
else
|
|
query=""
|
|
for kv in "$@"; do query="${query:+$query&}$kv"; done
|
|
curl -s --fail-with-body \
|
|
-H "x-api-key: $DOKPLOY_API_KEY" \
|
|
"$DOKPLOY_URL/api/$endpoint${query:+?$query}"
|
|
fi
|
|
echo
|