diff --git a/code-server/main.tf b/code-server/main.tf index c186c14..30b705c 100644 --- a/code-server/main.tf +++ b/code-server/main.tf @@ -95,6 +95,12 @@ variable "use_cached" { default = false } +variable "use_cached_extensions" { + type = bool + description = "Uses cached copy of extensions, otherwise do a forced upgrade" + default = false +} + variable "extensions_dir" { type = string description = "Override the directory to store extensions in." @@ -122,6 +128,7 @@ resource "coder_script" "code-server" { SETTINGS : replace(jsonencode(var.settings), "\"", "\\\""), OFFLINE : var.offline, USE_CACHED : var.use_cached, + USE_CACHED_EXTENSIONS : var.use_cached_extensions, EXTENSIONS_DIR : var.extensions_dir, FOLDER : var.folder, AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions, diff --git a/code-server/run.sh b/code-server/run.sh index 84a37cd..8cfc949 100755 --- a/code-server/run.sh +++ b/code-server/run.sh @@ -19,7 +19,7 @@ function run_code_server() { } function extension_installed() { - if [ "${USE_CACHED}" != true ]; then + if [ "${USE_CACHED_EXTENSIONS}" != true ]; then return 1 fi if [ -z "${EXTENSIONS_DIR}" ]; then @@ -89,7 +89,7 @@ for extension in "$${EXTENSIONLIST[@]}"; do continue fi printf "🧩 Installing extension $${CODE}$extension$${RESET}...\n" - output=$($CODE_SERVER "$EXTENSION_ARG" --install-extension "$extension") + output=$($CODE_SERVER "$EXTENSION_ARG" --force --install-extension "$extension") if [ $? -ne 0 ]; then echo "Failed to install extension: $extension: $output" exit 1 @@ -114,7 +114,7 @@ if [ "${AUTO_INSTALL_EXTENSIONS}" = true ]; then if extension_installed "$extension"; then continue fi - $CODE_SERVER "$EXTENSION_ARG" --install-extension "$extension" + $CODE_SERVER "$EXTENSION_ARG" --force --install-extension "$extension" done fi fi