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" {
148148 }
149149}
150150
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+
151157resource "coder_script" "code-server" {
152158 agent_id = var. agent_id
153159 display_name = " code-server"
@@ -168,6 +174,7 @@ resource "coder_script" "code-server" {
168174 EXTENSIONS_DIR : var.extensions_dir,
169175 FOLDER : var.folder,
170176 AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions,
177+ TRUSTED_DOMAINS : join (" ," , var. trusted_domains ),
171178 })
172179 run_on_start = true
173180
Original file line number Diff line number Diff line change @@ -13,10 +13,22 @@ if [ -n "${EXTENSIONS_DIR}" ]; then
1313 mkdir -p " ${EXTENSIONS_DIR} "
1414fi
1515
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+
1628function run_code_server() {
1729 echo " 👷 Running code-server in the background..."
1830 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 &
2032}
2133
2234# Check if the settings file exists...
You can’t perform that action at this time.
0 commit comments