Skip to content

Commit

Permalink
Pass settings.json file on vscode server workbench
Browse files Browse the repository at this point in the history
  • Loading branch information
atheo89 committed Feb 15, 2024
1 parent f874ac4 commit 2d98928
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions codeserver/ubi9-python-3.9/run-code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ fi
# Initilize access logs for culling
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/codeserver.access.log

# Directory for settings file
user_dir="/opt/app-root/src/.local/share/code-server/User/"
settings_filepath="${user_dir}settings.json"

json_settings='{
"python.defaultInterpreterPath": "/opt/app-root/bin/python3"
}'

# Check if User directory exists
if [ ! -d "$user_dir" ]; then
echo "Debug: User directory not found, creating '$user_dir'..."
mkdir -p "$user_dir"
echo "$json_settings" > "$settings_filepath"
echo "Debug: '$settings_filepath' file created."
else
echo "Debug: User directory already exists."
# Add settings.json if not present
if [ ! -f "$settings_filepath" ]; then
echo "Debug: '$settings_filepath' file not found, creating..."
echo "$json_settings" > "$settings_filepath"
echo "Debug: '$settings_filepath' file created."
else
echo "Debug: '$settings_filepath' file already exists."
fi
fi

# Check if code-server exists
if [ ! -f "/opt/app-root/src/.local/share/codeserver" ]; then

Expand Down

0 comments on commit 2d98928

Please sign in to comment.