summaryrefslogtreecommitdiff
path: root/scripts/sandbox_command.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sandbox_command.sh')
-rwxr-xr-xscripts/sandbox_command.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/sandbox_command.sh b/scripts/sandbox_command.sh
index fab94b52..f527292c 100755
--- a/scripts/sandbox_command.sh
+++ b/scripts/sandbox_command.sh
@@ -31,6 +31,16 @@ while getopts ":q" opt; do
done
shift $((OPTIND - 1))
+# if GEMINI_CODE_SANDBOX is not set, see if it is set in user settings
+# note it can be string or boolean, and if missing jq will return null
+USER_SETTINGS_FILE=~/.gemini/settings.json
+if [ -z "${GEMINI_CODE_SANDBOX:-}" ] && [ -f "$USER_SETTINGS_FILE" ]; then
+ USER_SANDBOX_SETTING=$(jq -r '.sandbox' "$USER_SETTINGS_FILE")
+ if [ "$USER_SANDBOX_SETTING" != null ]; then
+ GEMINI_CODE_SANDBOX=$USER_SANDBOX_SETTING
+ fi
+fi
+
# if GEMINI_CODE_SANDBOX is not set, try to source .env in case set there
# allow .env to be in any ancestor directory (same as findEnvFile in config.ts)
if [ -z "${GEMINI_CODE_SANDBOX:-}" ]; then