This repository was archived by the owner on May 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -48,3 +48,20 @@ module "vscode-web" {
48
48
accept_license = true
49
49
}
50
50
```
51
+
52
+ ### Pre-configure Settings
53
+
54
+ Configure VS Code's [ settings.json] ( https://code.visualstudio.com/docs/getstarted/settings#_settingsjson ) file:
55
+
56
+ ``` tf
57
+ module "vscode-web" {
58
+ source = "registry.coder.com/modules/vscode-web/coder"
59
+ version = "1.0.8"
60
+ agent_id = coder_agent.example.id
61
+ extensions = ["dracula-theme.theme-dracula"]
62
+ settings = {
63
+ "workbench.colorTheme" = "Dracula"
64
+ }
65
+ accept_license = true
66
+ }
67
+ ```
Original file line number Diff line number Diff line change @@ -91,6 +91,12 @@ variable "order" {
91
91
default = null
92
92
}
93
93
94
+ variable "settings" {
95
+ type = map (string )
96
+ description = " A map of settings to apply to VS Code web."
97
+ default = {}
98
+ }
99
+
94
100
resource "coder_script" "vscode-web" {
95
101
agent_id = var. agent_id
96
102
display_name = " VS Code Web"
@@ -101,6 +107,8 @@ resource "coder_script" "vscode-web" {
101
107
INSTALL_PREFIX : var.install_prefix,
102
108
EXTENSIONS : join (" ," , var. extensions ),
103
109
TELEMETRY_LEVEL : var.telemetry_level,
110
+ // This is necessary otherwise the quotes are stripped!
111
+ SETTINGS : replace (jsonencode (var. settings ), " \" " , " \\\" " ),
104
112
})
105
113
run_on_start = true
106
114
}
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ case "$ARCH" in
19
19
;;
20
20
esac
21
21
22
- HASH=$( curl https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH -web | cut -d ' "' -f 2)
23
- output=$( curl -sL https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH /vscode-server-linux-$ARCH -web.tar.gz | tar -xz -C ${INSTALL_PREFIX} --strip-components 1)
22
+ HASH=$( curl -fsSL https://update.code.visualstudio.com/api/commits/stable/server-linux-$ARCH -web | cut -d ' "' -f 2)
23
+ output=$( curl -fsSL https://vscode.download.prss.microsoft.com/dbazure/download/stable/$HASH /vscode-server-linux-$ARCH -web.tar.gz | tar -xz -C ${INSTALL_PREFIX} --strip-components 1)
24
24
25
25
if [ $? -ne 0 ]; then
26
26
echo " Failed to install Microsoft Visual Studio Code Server: $output "
@@ -44,6 +44,13 @@ for extension in "$${EXTENSIONLIST[@]}"; do
44
44
fi
45
45
done
46
46
47
+ # Check if the settings file exists...
48
+ if [ ! -f ~ /.vscode-server/data/Machine/settings.json ]; then
49
+ echo " ⚙️ Creating settings file..."
50
+ mkdir -p ~ /.vscode-server/data/Machine
51
+ echo " ${SETTINGS} " > ~ /.vscode-server/data/Machine/settings.json
52
+ fi
53
+
47
54
echo " 👷 Running ${INSTALL_PREFIX} /bin/code-server serve-local --port ${PORT} --accept-server-license-terms serve-local --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..."
48
55
echo " Check logs at ${LOG_PATH} !"
49
56
" ${INSTALL_PREFIX} /bin/code-server" serve-local --port " ${PORT} " --accept-server-license-terms serve-local --without-connection-token --telemetry-level " ${TELEMETRY_LEVEL} " > " ${LOG_PATH} " 2>&1 &
You can’t perform that action at this time.
0 commit comments