File size: 913 Bytes
c12eb19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash
set -euo pipefail
# Some CLI versions change their option names. Keep the upstream AHP private.
help="$(/usr/local/bin/code agent host --help 2>&1 || true)"
args=(agent host)
if grep -q -- '--host' <<<"$help"; then args+=(--host 127.0.0.1); fi
if grep -q -- '--port' <<<"$help"; then args+=(--port 7242); fi
if grep -q -- '--without-connection-token' <<<"$help"; then
    args+=(--without-connection-token)
else
    echo >&2 "FATAL: VS Code CLI cannot disable its connection token for private loopback AHP; bridge cannot connect using configured anonymous local WebSocket."
    exit 42
fi
if grep -q -- '--server-data-dir' <<<"$help"; then args+=(--server-data-dir /home/coder/data/agent-host); fi
if grep -q -- '--foreground' <<<"$help"; then args+=(--foreground); else echo >&2 "FATAL: Agent Host must run in foreground under supervisord."; exit 43; fi
exec /usr/local/bin/code "${args[@]}"