Skip to content

Commit e928205

Browse files
feat: add githubAuthTokenFile option
1 parent 245befb commit e928205

File tree

6 files changed

+39
-0
lines changed

6 files changed

+39
-0
lines changed

src/code-server/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ VS Code in the browser
2929
| disableWorkspaceTrust | Disable Workspace Trust feature. This only affects the current session. | boolean | false |
3030
| enableProposedAPI | Comma-separated list of VS Code extension IDs to enable proposed API features for. | string | - |
3131
| extensions | Comma-separated list of VS Code extensions to install. Format: 'publisher.extension[@version]' (e.g., 'ms-python.python,ms-azuretools.vscode-docker'). | string | - |
32+
| githubAuthTokenFile | Path to a file containing your GitHub auth token. | string | - |
3233
| hashedPasswordFile | Path to a file containing the hashed password used for authentication. The password should be hashed with argon2 and be in the encoded form. This takes priority over `passwordFile`. | string | - |
3334
| host | The address to bind to for the code-server. Use '0.0.0.0' to listen on all interfaces. | string | 127.0.0.1 |
3435
| locale | Set VS Code display language and language shown on the login page. Format should be an IETF language tag (e.g., 'en', 'fr', 'zh-CN'). | string | - |

src/code-server/devcontainer-feature.json

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
"default": "",
7676
"description": "Comma-separated list of VS Code extensions to install. Format: 'publisher.extension[@version]' (e.g., 'ms-python.python,ms-azuretools.vscode-docker')."
7777
},
78+
"githubAuthTokenFile": {
79+
"type": "string",
80+
"default": "",
81+
"description": "Path to a file containing your GitHub auth token."
82+
},
7883
"hashedPasswordFile": {
7984
"type": "string",
8085
"default": "",

src/code-server/install.sh

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ if [[ -f "$HASHEDPASSWORDFILE" ]]; then
124124
export HASHED_PASSWORD="\$(cat '$HASHEDPASSWORDFILE')"
125125
fi
126126
127+
if [[ -f "$GITHUBAUTHTOKENFILE" ]]; then
128+
export GITHUB_TOKEN="\$(cat '$GITHUBAUTHTOKENFILE')"
129+
fi
130+
127131
code-server "\${FLAGS[@]}" "$CODE_SERVER_WORKSPACE" >"$LOGFILE" 2>&1
128132
EOF
129133

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
# Feature-specific tests
8+
check "code-server version" code-server --version
9+
check "code-server running" pgrep -f 'code-server/lib/node.*/code-server'
10+
check "code-server listening" lsof -i "@127.0.0.1:8080"
11+
12+
cat /tmp/code-server.log
13+
check "code-server github-auth-token-file" grep $'export GITHUB_TOKEN="$(cat \'/tmp/code-server-github-auth-token\')"' < /usr/local/bin/code-server-entrypoint
14+
15+
# Report results
16+
reportResults
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu
2+
3+
RUN su vscode -c 'echo "github auth token" > /tmp/code-server-github-auth-token'

test/code-server/scenarios.json

+10
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,15 @@
247247
"hashedPasswordFile": "/tmp/code-server-hashed-password"
248248
}
249249
}
250+
},
251+
"code-server-github-auth-token-file": {
252+
"build": {
253+
"dockerfile": "Dockerfile"
254+
},
255+
"features": {
256+
"code-server": {
257+
"githubAuthTokenFile": "/tmp/code-server-github-auth-token"
258+
}
259+
}
250260
}
251261
}

0 commit comments

Comments
 (0)