Prefer Forgejo as the self-hosted forge product. Keep Gitea only as the Gitea-compatible API identifier (module backends/gitea, type string gitea). FORGEJO_TOKEN is preferred; GITEA_* remains a deprecated alias. INTENT/SCOPE quote ACT-ADR-005: issue-core is not the fleet ops claim queue. Connector docs describe repo work record → hub index → optional Forgejo projection, not activity-core → issue-core → harness. Assistant: grok Assistant-Session: 01a09dc6-3f0d-7c93-8b11-8e83c0623d49
32 lines
1.3 KiB
Bash
32 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# Render issue-core backends.json from environment, then start the API.
|
|
#
|
|
# The backend structure (host/owner/repo/default) is non-secret and supplied
|
|
# via the BACKENDS_TEMPLATE env (a ConfigMap), with the Forgejo token injected
|
|
# from FORGEJO_BACKEND_TOKEN (preferred) or GITEA_BACKEND_TOKEN (deprecated
|
|
# alias; ExternalSecret-materialized Secret). The token is never baked into
|
|
# the image or committed to Git.
|
|
set -eu
|
|
|
|
CONFIG_DIR="${HOME}/.config/issue-tracker"
|
|
mkdir -p "${CONFIG_DIR}"
|
|
|
|
: "${BACKENDS_TEMPLATE:?BACKENDS_TEMPLATE env is required}"
|
|
|
|
# Substitute the token placeholder using python (always present in the image)
|
|
# to avoid shell-escaping issues with the secret value.
|
|
FORGEJO_BACKEND_TOKEN="${FORGEJO_BACKEND_TOKEN:-}" \
|
|
GITEA_BACKEND_TOKEN="${GITEA_BACKEND_TOKEN:-}" \
|
|
BACKENDS_TEMPLATE="${BACKENDS_TEMPLATE}" \
|
|
python - "${CONFIG_DIR}/backends.json" <<'PY'
|
|
import json, os, sys
|
|
tmpl = json.loads(os.environ["BACKENDS_TEMPLATE"])
|
|
token = os.environ.get("FORGEJO_BACKEND_TOKEN") or os.environ.get("GITEA_BACKEND_TOKEN", "")
|
|
for cfg in tmpl.values():
|
|
if isinstance(cfg, dict) and cfg.get("token") == "__FROM_ENV__":
|
|
cfg["token"] = token
|
|
with open(sys.argv[1], "w") as fh:
|
|
json.dump(tmpl, fh, indent=2)
|
|
PY
|
|
|
|
exec issue serve --host 0.0.0.0 --port 8765 --log-level "${LOG_LEVEL:-info}"
|