Merge pull request 'fix: disinto init: project TOML uses localhost forge_url, breaks agents container (#782)' (#794) from fix/issue-782 into main
This commit is contained in:
commit
779584be2d
2 changed files with 14 additions and 5 deletions
|
|
@ -21,10 +21,11 @@ FAILED=0
|
|||
# Uses awk instead of grep -Eo for busybox/Alpine compatibility (#296).
|
||||
get_fns() {
|
||||
local f="$1"
|
||||
# BRE mode (no -E): () is literal in BRE, avoiding BusyBox ERE bugs
|
||||
# where \(\) is misinterpreted. BRE one-or-more via [X][X]* instead of +.
|
||||
grep '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_][a-zA-Z0-9_]*[[:space:]]*()' "$f" 2>/dev/null \
|
||||
| sed 's/^[[:space:]]*//; s/[[:space:]]*().*$//' \
|
||||
# BRE mode (no -E). Use [(][)] for literal parens — unambiguous across
|
||||
# GNU grep and BusyBox grep (some BusyBox builds treat bare () as grouping
|
||||
# even in BRE). BRE one-or-more via [X][X]* instead of +.
|
||||
grep '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_][a-zA-Z0-9_]*[[:space:]]*[(][)]' "$f" 2>/dev/null \
|
||||
| sed 's/^[[:space:]]*//; s/[[:space:]]*[(][)].*$//' \
|
||||
| sort -u || true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue