@@ -23,70 +23,67 @@ if [[ -n $WORKSPACE ]]; then
23
23
CODE_SERVER_WORKSPACE=" $WORKSPACE "
24
24
fi
25
25
26
- DISABLE_FLAGS=()
26
+ FLAGS=()
27
+ FLAGS+=(--auth " $AUTH " )
28
+ FLAGS+=(--bind-addr " $HOST :$PORT " )
27
29
28
30
if [[ " $DISABLEFILEDOWNLOADS " == " true" ]]; then
29
- DISABLE_FLAGS +=(--disable-file-downloads)
31
+ FLAGS +=(--disable-file-downloads)
30
32
fi
31
33
32
34
if [[ " $DISABLEFILEUPLOADS " == " true" ]]; then
33
- DISABLE_FLAGS +=(--disable-file-uploads)
35
+ FLAGS +=(--disable-file-uploads)
34
36
fi
35
37
36
38
if [[ " $DISABLEGETTINGSTARTEDOVERRIDE " == " true" ]]; then
37
- DISABLE_FLAGS +=(--disable-getting-started-override)
39
+ FLAGS +=(--disable-getting-started-override)
38
40
fi
39
41
40
42
if [[ " $DISABLEPROXY " == " true" ]]; then
41
- DISABLE_FLAGS +=(--disable-proxy)
43
+ FLAGS +=(--disable-proxy)
42
44
fi
43
45
44
46
if [[ " $DISABLETELEMETRY " == " true" ]]; then
45
- DISABLE_FLAGS +=(--disable-telemetry)
47
+ FLAGS +=(--disable-telemetry)
46
48
fi
47
49
48
50
if [[ " $DISABLEUPDATECHECK " == " true" ]]; then
49
- DISABLE_FLAGS +=(--disable-update-check)
51
+ FLAGS +=(--disable-update-check)
50
52
fi
51
53
52
54
if [[ " $DISABLEWORKSPACETRUST " == " true" ]]; then
53
- DISABLE_FLAGS +=(--disable-workspace-trust)
55
+ FLAGS +=(--disable-workspace-trust)
54
56
fi
55
57
56
- CERT_FLAGS=()
57
-
58
58
if [[ -n " $CERT " ]]; then
59
- CERT_FLAGS +=(--cert " $CERT " )
59
+ FLAGS +=(--cert " $CERT " )
60
60
fi
61
61
62
62
if [[ -n " $CERTHOST " ]]; then
63
- CERT_FLAGS +=(--cert-host " $CERTHOST " )
63
+ FLAGS +=(--cert-host " $CERTHOST " )
64
64
fi
65
65
66
66
if [[ -n " $CERTKEY " ]]; then
67
- CERT_FLAGS +=(--cert-key " $CERTKEY " )
67
+ FLAGS +=(--cert-key " $CERTKEY " )
68
68
fi
69
69
70
- SOCKET_FLAGS=()
71
-
72
70
if [[ -n " $SOCKET " ]]; then
73
- SOCKET_FLAGS +=(--socket " $SOCKET " )
71
+ FLAGS +=(--socket " $SOCKET " )
74
72
fi
75
73
76
74
if [[ -n " $SOCKETMODE " ]]; then
77
- SOCKET_FLAGS +=(--socket-mode " $SOCKETMODE " )
75
+ FLAGS +=(--socket-mode " $SOCKETMODE " )
78
76
fi
79
77
80
- cat > /usr/local/bin/code-server-entrypoint \
81
- << EOF
78
+ cat > /usr/local/bin/code-server-entrypoint << EOF
82
79
#!/usr/bin/env bash
83
80
set -e
84
81
85
- $( declare -p DISABLE_FLAGS )
86
- $( declare -p CERT_FLAGS )
87
- $( declare -p SOCKET_FLAGS )
82
+ $( declare -p FLAGS )
83
+
84
+ CMD="code-server \$ {FLAGS[@]} \" $CODE_SERVER_WORKSPACE \""
88
85
89
- su $_REMOTE_USER -c 'code-server --auth " $AUTH " --bind-addr " $HOST : $PORT " " \$ {DISABLE_FLAGS[@]}" " \$ {CERT_FLAGS[@]}" " \$ {SOCKET_FLAGS[@]}" " $CODE_SERVER_WORKSPACE "'
86
+ su $_REMOTE_USER -c " \$ CMD"
90
87
EOF
91
88
92
89
chmod +x /usr/local/bin/code-server-entrypoint
0 commit comments