fix: bug: edge entrypoint defaults FORGE_REPO to disinto-admin/disinto — footgun for non-disinto deployments (#543) #562
1 changed files with 30 additions and 1 deletions
|
|
@ -5,7 +5,36 @@ set -euo pipefail
|
||||||
export USER="${USER:-root}"
|
export USER="${USER:-root}"
|
||||||
|
|
||||||
FORGE_URL="${FORGE_URL:-http://forgejo:3000}"
|
FORGE_URL="${FORGE_URL:-http://forgejo:3000}"
|
||||||
FORGE_REPO="${FORGE_REPO:-disinto-admin/disinto}"
|
|
||||||
|
# Derive FORGE_REPO from PROJECT_TOML if available, otherwise require explicit env var
|
||||||
|
if [ -z "${FORGE_REPO:-}" ]; then
|
||||||
|
# Try to find a project TOML to derive FORGE_REPO from
|
||||||
|
_project_toml="${PROJECT_TOML:-}"
|
||||||
|
if [ -z "$_project_toml" ] && [ -d "${FACTORY_ROOT:-/opt/disinto}/projects" ]; then
|
||||||
|
for toml in "${FACTORY_ROOT:-/opt/disinto}"/projects/*.toml; do
|
||||||
|
if [ -f "$toml" ]; then
|
||||||
|
_project_toml="$toml"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$_project_toml" ] && [ -f "$_project_toml" ]; then
|
||||||
|
# Parse FORGE_REPO from project TOML using load-project.sh
|
||||||
|
if source "${FACTORY_ROOT:-/opt/disinto}/lib/load-project.sh" "$_project_toml" 2>/dev/null; then
|
||||||
|
if [ -n "${FORGE_REPO:-}" ]; then
|
||||||
|
echo "Derived FORGE_REPO from PROJECT_TOML: $_project_toml" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If still not set, fail fast with a clear error message
|
||||||
|
if [ -z "${FORGE_REPO:-}" ]; then
|
||||||
|
echo "FATAL: FORGE_REPO environment variable not set" >&2
|
||||||
|
echo "Set FORGE_REPO=<owner>/<repo> in .env (e.g. FORGE_REPO=disinto-admin/disinto)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Shallow clone at the pinned version (inject token to support auth-required Forgejo)
|
# Shallow clone at the pinned version (inject token to support auth-required Forgejo)
|
||||||
if [ ! -d /opt/disinto/.git ]; then
|
if [ ! -d /opt/disinto/.git ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue