fix: disinto init: project TOML uses localhost forge_url, breaks agents container (#782)

When DISINTO_CONTAINER=1, load-project.sh now skips overriding env vars
that are already set by docker-compose (FORGE_URL, PROJECT_REPO_ROOT,
OPS_REPO_ROOT, etc.).  This prevents the TOML's host-perspective values
(localhost, /home/johba/…) from clobbering the correct container values
(forgejo:3000, /home/agent/…).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-27 16:13:59 +00:00
parent bf50647545
commit 1a72ddc1bd

View file

@ -80,9 +80,17 @@ if mirrors:
return 1 2>/dev/null || exit 1
}
# Export parsed variables
# Export parsed variables.
# Inside the agents container (DISINTO_CONTAINER=1), compose already sets the
# correct FORGE_URL (http://forgejo:3000) and path vars for the container
# environment. The TOML carries host-perspective values (localhost, /home/johba/…)
# that would break container API calls and path resolution. Skip overriding
# any env var that is already set when running inside the container.
while IFS='=' read -r _key _val; do
[ -z "$_key" ] && continue
if [ "${DISINTO_CONTAINER:-}" = "1" ] && [ -n "${!_key:-}" ]; then
continue
fi
export "$_key=$_val"
done <<< "$_PROJECT_VARS"