From fe043f4368b7d40e12aa46a54ae6963781cbffca Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Apr 2026 07:58:10 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20bug:=20edge=20entrypoint=20defaults?= =?UTF-8?q?=20FORGE=5FREPO=20to=20`disinto-admin/disinto`=20=E2=80=94=20fo?= =?UTF-8?q?otgun=20for=20non-disinto=20deployments=20(#543)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/edge/entrypoint-edge.sh | 36 +++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docker/edge/entrypoint-edge.sh b/docker/edge/entrypoint-edge.sh index 7f21bf9..2f77de4 100755 --- a/docker/edge/entrypoint-edge.sh +++ b/docker/edge/entrypoint-edge.sh @@ -5,7 +5,41 @@ set -euo pipefail export USER="${USER:-root}" 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 and parse PROJECT_TOML + _project_toml="${PROJECT_TOML:-}" + if [ -z "$_project_toml" ]; then + # Default path for project TOML in container + _project_toml="${FACTORY_ROOT:-/opt/disinto}/projects/disinto.toml" + fi + # Also check the generic projects directory + if [ ! -f "$_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 "${SCRIPT_ROOT:-$(dirname "${BASH_SOURCE[0]}")}/../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=/ 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) if [ ! -d /opt/disinto/.git ]; then From 58fd3cbde15296946c8fd11987c551d92c454451 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 10 Apr 2026 08:03:55 +0000 Subject: [PATCH 2/2] fix: remove disinto-specific TOML fallback and fix load-project.sh path in edge entrypoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove hardcoded `disinto.toml` as default TOML search path; scan projects/ directory for any .toml instead - Fix load-project.sh path: use FACTORY_ROOT (consistent with the rest of the block) instead of SCRIPT_ROOT/BASH_SOURCE which resolves to /usr/local/bin in the container — wrong for /opt/disinto/lib/ Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/edge/entrypoint-edge.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/docker/edge/entrypoint-edge.sh b/docker/edge/entrypoint-edge.sh index 2f77de4..6517511 100755 --- a/docker/edge/entrypoint-edge.sh +++ b/docker/edge/entrypoint-edge.sh @@ -8,14 +8,9 @@ FORGE_URL="${FORGE_URL:-http://forgejo:3000}" # Derive FORGE_REPO from PROJECT_TOML if available, otherwise require explicit env var if [ -z "${FORGE_REPO:-}" ]; then - # Try to find and parse PROJECT_TOML + # Try to find a project TOML to derive FORGE_REPO from _project_toml="${PROJECT_TOML:-}" - if [ -z "$_project_toml" ]; then - # Default path for project TOML in container - _project_toml="${FACTORY_ROOT:-/opt/disinto}/projects/disinto.toml" - fi - # Also check the generic projects directory - if [ ! -f "$_project_toml" ] && [ -d "${FACTORY_ROOT:-/opt/disinto}/projects" ]; then + 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" @@ -26,7 +21,7 @@ if [ -z "${FORGE_REPO:-}" ]; then if [ -n "$_project_toml" ] && [ -f "$_project_toml" ]; then # Parse FORGE_REPO from project TOML using load-project.sh - if source "${SCRIPT_ROOT:-$(dirname "${BASH_SOURCE[0]}")}/../lib/load-project.sh" "$_project_toml" 2>/dev/null; then + 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