add cloudflare and documentation

This commit is contained in:
2025-12-22 23:25:06 +01:00
parent fbc8bcd089
commit 4590d46e17
17 changed files with 427 additions and 5 deletions

30
scripts/run.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
# Simple runner: builds binary if missing then runs it.
# Environment variables supported:
# - BIN (path to binary, default ./safelineApi)
# - CONFIG (path to config.json, default ./config.json)
# - SAFELINE_API_TOKEN, DNS_PROVIDER, CONTACT_EMAIL (optional flags passed to binary)
BIN=${BIN:-./safelineApi}
CONFIG=${CONFIG:-./config.json}
if [ ! -f "$BIN" ]; then
echo "Binary not found, building..."
GOOS=${GOOS:-linux} GOARCH=${GOARCH:-amd64} go build -o "$BIN" ./cmd/safelineApi
fi
ARGS=()
if [ -n "${SAFELINE_API_TOKEN:-}" ]; then
ARGS+=("-t" "$SAFELINE_API_TOKEN")
fi
if [ -n "${DNS_PROVIDER:-}" ]; then
ARGS+=("-D" "$DNS_PROVIDER")
fi
if [ -n "${CONTACT_EMAIL:-}" ]; then
ARGS+=("-e" "$CONTACT_EMAIL")
fi
echo "Starting SafelineAPI ($BIN) with config: $CONFIG"
"$BIN" "${ARGS[@]}"