|
16 | 16 | # Initilize access logs for culling
|
17 | 17 | echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/codeserver.access.log
|
18 | 18 |
|
19 |
| -# Directory for settings file |
20 |
| -user_dir="/opt/app-root/src/.local/share/code-server/User/" |
| 19 | +# Add "/opt/app-root/src/.vscode/" directory to set default interpreter also for Run & Debug |
| 20 | +user_dir="/opt/app-root/src/.vscode/" |
21 | 21 | settings_filepath="${user_dir}settings.json"
|
| 22 | +launch_filepath="${user_dir}launch.json" |
| 23 | + |
| 24 | +json_launch_settings='{ |
| 25 | + // Use IntelliSense to learn about possible attributes. |
| 26 | + // Hover to view descriptions of existing attributes. |
| 27 | + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
| 28 | + "version": "0.2.0", |
| 29 | + "configurations": [ |
| 30 | + { |
| 31 | + "name": "Python Debugger: Current File", |
| 32 | + "type": "debugpy", |
| 33 | + "request": "launch", |
| 34 | + "program": "${file}", |
| 35 | + "console": "integratedTerminal", |
| 36 | + "python": "/opt/app-root/bin/python3" |
| 37 | + } |
| 38 | + ] |
| 39 | +}' |
22 | 40 |
|
23 | 41 | json_settings='{
|
24 | 42 | "python.defaultInterpreterPath": "/opt/app-root/bin/python3"
|
25 |
| -}' |
| 43 | + }' |
26 | 44 |
|
27 | 45 | # Check if User directory exists
|
28 | 46 | if [ ! -d "$user_dir" ]; then
|
29 | 47 | echo "Debug: User directory not found, creating '$user_dir'..."
|
30 | 48 | mkdir -p "$user_dir"
|
| 49 | + echo "$json_launch_settings" > "$launch_filepath" |
| 50 | + echo "Debug: '$launch_filepath' file created." |
31 | 51 | echo "$json_settings" > "$settings_filepath"
|
32 | 52 | echo "Debug: '$settings_filepath' file created."
|
33 | 53 | else
|
34 | 54 | echo "Debug: User directory already exists."
|
35 |
| - # Add settings.json if not present |
36 |
| - if [ ! -f "$settings_filepath" ]; then |
| 55 | + # Add settings.json and launch.json if not present |
| 56 | + if [ ! -f "$launch_filepath" ]; then |
| 57 | + echo "Debug: '$launch_filepath' file not found, creating..." |
| 58 | + echo "$json_launch_settings" > "$launch_filepath" |
| 59 | + echo "Debug: '$launch_filepath' file created." |
| 60 | + elif [ ! -f "$settings_filepath" ]; then |
37 | 61 | echo "Debug: '$settings_filepath' file not found, creating..."
|
38 | 62 | echo "$json_settings" > "$settings_filepath"
|
39 | 63 | echo "Debug: '$settings_filepath' file created."
|
40 | 64 | else
|
| 65 | + echo "Debug: '$launch_filepath' file already exists." |
41 | 66 | echo "Debug: '$settings_filepath' file already exists."
|
| 67 | + |
42 | 68 | fi
|
43 | 69 | fi
|
44 | 70 |
|
|
0 commit comments