File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
registry/coder/modules/code-server Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,12 @@ variable "open_in" {
148
148
}
149
149
}
150
150
151
+ variable "trusted_domains" {
152
+ type = list (string )
153
+ description = " A list of trusted domains for link protection. These domains will be added to the --link-protection-trusted-domains option."
154
+ default = []
155
+ }
156
+
151
157
resource "coder_script" "code-server" {
152
158
agent_id = var. agent_id
153
159
display_name = " code-server"
@@ -168,6 +174,7 @@ resource "coder_script" "code-server" {
168
174
EXTENSIONS_DIR : var.extensions_dir,
169
175
FOLDER : var.folder,
170
176
AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions,
177
+ TRUSTED_DOMAINS : join (" ," , var. trusted_domains ),
171
178
})
172
179
run_on_start = true
173
180
Original file line number Diff line number Diff line change @@ -13,10 +13,22 @@ if [ -n "${EXTENSIONS_DIR}" ]; then
13
13
mkdir -p " ${EXTENSIONS_DIR} "
14
14
fi
15
15
16
+ # Set trusted domains argument
17
+ TRUSTED_DOMAINS_ARG=" "
18
+ if [ -n " ${TRUSTED_DOMAINS} " ]; then
19
+ # Split comma-separated domains and create multiple --link-protection-trusted-domains arguments
20
+ IFS=' ,' read -r -a DOMAINS_ARRAY <<< " ${TRUSTED_DOMAINS}"
21
+ for domain in " ${DOMAINS_ARRAY[@]} " ; do
22
+ if [ -n " $domain " ]; then
23
+ TRUSTED_DOMAINS_ARG=" $TRUSTED_DOMAINS_ARG --link-protection-trusted-domains=${domain} "
24
+ fi
25
+ done
26
+ fi
27
+
16
28
function run_code_server() {
17
29
echo " 👷 Running code-server in the background..."
18
30
echo " Check logs at ${LOG_PATH} !"
19
- $CODE_SERVER " $EXTENSION_ARG " --auth none --port " ${PORT} " --app-name " ${APP_NAME} " > " ${LOG_PATH} " 2>&1 &
31
+ $CODE_SERVER $EXTENSION_ARG $TRUSTED_DOMAINS_ARG --auth none --port " ${PORT} " --app-name " ${APP_NAME} " > " ${LOG_PATH} " 2>&1 &
20
32
}
21
33
22
34
# Check if the settings file exists...
You can’t perform that action at this time.
0 commit comments