This commit is contained in:
2026-03-07 22:43:08 +03:00
parent 61e7e3af56
commit 7a86519314
17 changed files with 2316 additions and 1 deletions

36
start.sh Normal file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$BASE_DIR"
if [[ ! -d .venv ]]; then
python3 -m venv .venv
fi
# shellcheck disable=SC1091
source .venv/bin/activate
python3 -c "import aiohttp, zeroconf" >/dev/null 2>&1 || {
echo "Missing deps in .venv. Run install.sh"
exit 3
}
TOKEN="${YANDEX_TOKEN:-}"
if [[ -z "$TOKEN" && -f "$BASE_DIR/token.txt" ]]; then
TOKEN="$(tr -d '\r' < "$BASE_DIR/token.txt")"
fi
if [[ -z "$TOKEN" ]]; then
echo "YANDEX_TOKEN is empty and token.txt not found"
exit 2
fi
BIND_HOST="${YASTATION_BIND_HOST:-127.0.0.1}"
BIND_PORT="${YASTATION_BIND_PORT:-9123}"
HTTP_HOST="${YASTATION_HTTP_HOST:-0.0.0.0}"
HTTP_PORT="${YASTATION_HTTP_PORT:-9124}"
exec "$BASE_DIR/.venv/bin/python3" "$BASE_DIR/yastation.py" --token "$TOKEN" serve \
--host "$BIND_HOST" \
--port "$BIND_PORT" \
--http-host "$HTTP_HOST" \
--http-port "$HTTP_PORT"