Merge pull request 'fix: fix: agents container cannot reach Forgejo — lib/env.sh overrides compose FORGE_URL with .env localhost (#660)' (#662) from fix/issue-660 into main
This commit is contained in:
commit
7af70e9099
1 changed files with 16 additions and 11 deletions
11
lib/env.sh
11
lib/env.sh
|
|
@ -15,17 +15,22 @@ if [ "${DISINTO_CONTAINER:-}" = "1" ]; then
|
||||||
mkdir -p "${DISINTO_DATA_DIR}"
|
mkdir -p "${DISINTO_DATA_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load secrets: prefer .env.enc (SOPS-encrypted), fall back to plaintext .env
|
# Load secrets: prefer .env.enc (SOPS-encrypted), fall back to plaintext .env.
|
||||||
if [ -f "$FACTORY_ROOT/.env.enc" ] && command -v sops &>/dev/null; then
|
# Inside the container, compose already injects env vars via env_file + environment
|
||||||
|
# overrides (e.g. FORGE_URL=http://forgejo:3000). Re-sourcing .env would clobber
|
||||||
|
# those compose-level values, so we skip it when DISINTO_CONTAINER=1.
|
||||||
|
if [ "${DISINTO_CONTAINER:-}" != "1" ]; then
|
||||||
|
if [ -f "$FACTORY_ROOT/.env.enc" ] && command -v sops &>/dev/null; then
|
||||||
set -a
|
set -a
|
||||||
eval "$(sops -d --output-type dotenv "$FACTORY_ROOT/.env.enc" 2>/dev/null)" \
|
eval "$(sops -d --output-type dotenv "$FACTORY_ROOT/.env.enc" 2>/dev/null)" \
|
||||||
|| echo "Warning: failed to decrypt .env.enc — secrets not loaded" >&2
|
|| echo "Warning: failed to decrypt .env.enc — secrets not loaded" >&2
|
||||||
set +a
|
set +a
|
||||||
elif [ -f "$FACTORY_ROOT/.env" ]; then
|
elif [ -f "$FACTORY_ROOT/.env" ]; then
|
||||||
set -a
|
set -a
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "$FACTORY_ROOT/.env"
|
source "$FACTORY_ROOT/.env"
|
||||||
set +a
|
set +a
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# PATH: foundry, node, system
|
# PATH: foundry, node, system
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue