File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,26 @@ REPO_LIST="${REPOSITORIES:-}"
4949mkdir -p " ${WORKSPACE_DIR} "
5050cd " ${WORKSPACE_DIR} "
5151
52+ # ============================================================================
53+ # Persist workspace environment for SSH sessions
54+ # SSH sessions don't inherit the container's runtime environment, so we write
55+ # critical variables to /etc/profile.d/ which gets sourced by login shells
56+ # ============================================================================
57+ if [[ -n " ${CLOUD_API_URL:- } " || -n " ${WORKSPACE_ID:- } " ]]; then
58+ log " Persisting workspace environment for SSH sessions"
59+ cat > /etc/profile.d/workspace-env.sh << ENVEOF
60+ # Workspace environment variables (auto-generated by entrypoint.sh)
61+ export WORKSPACE_ID="${WORKSPACE_ID:- } "
62+ export CLOUD_API_URL="${CLOUD_API_URL:- } "
63+ export WORKSPACE_TOKEN="${WORKSPACE_TOKEN:- } "
64+ export WORKSPACE_DIR="${WORKSPACE_DIR} "
65+ export HOME="${HOME} "
66+ export AGENT_RELAY_USER_ID="${AGENT_RELAY_USER_ID:- } "
67+ export AGENT_RELAY_DATA_DIR="${AGENT_RELAY_DATA_DIR:-/ data} "
68+ ENVEOF
69+ chmod 644 /etc/profile.d/workspace-env.sh
70+ fi
71+
5272# Configure Git credentials via the gateway (tokens auto-refresh via Nango)
5373# The credential helper fetches fresh tokens from the cloud API on each git operation
5474if [[ -n " ${CLOUD_API_URL:- } " && -n " ${WORKSPACE_ID:- } " && -n " ${WORKSPACE_TOKEN:- } " ]]; then
You can’t perform that action at this time.
0 commit comments