Skip to content

Commit 420ac83

Browse files
committed
update entrypoint
1 parent 5d2f152 commit 420ac83

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

deploy/workspace/entrypoint.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,26 @@ REPO_LIST="${REPOSITORIES:-}"
4949
mkdir -p "${WORKSPACE_DIR}"
5050
cd "${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
5474
if [[ -n "${CLOUD_API_URL:-}" && -n "${WORKSPACE_ID:-}" && -n "${WORKSPACE_TOKEN:-}" ]]; then

0 commit comments

Comments
 (0)