add cloudflare and documentation
This commit is contained in:
30
scripts/run.sh
Normal file
30
scripts/run.sh
Normal 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[@]}"
|
||||
Reference in New Issue
Block a user