#!/usr/bin/env bash
# Save Override — point the app at the test-catv2 environment.
# Writes the client config.json api_url override. Undo with switch-to-prod.sh.
set -euo pipefail

cfg_dir="${SO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/save-override}"
cfg_file="$cfg_dir/config.json"

mkdir -p "$cfg_dir"
printf '%s\n' '{"api_url":"https://api.test-catv2.save-override.com"}' >"$cfg_file"

echo "Save Override now points at the test-catv2 environment."
echo "Config: $cfg_file"
echo
echo "Quit Save Override completely and relaunch it to apply the change."
echo "Sign in with the test-catv2 credentials we sent you."
