[tea-rbw] Bug fixes

This commit is contained in:
2025-09-06 19:02:25 -07:00
parent b22a4952e5
commit a90b30eb1c

View File

@@ -4,7 +4,7 @@ pkgs.writeShellScriptBin "tea" ''
set -euo pipefail set -euo pipefail
# Check if tea config directory exists and has authentication # Check if tea config directory exists and has authentication
TEA_CONFIG_DIR="$HOME/.tea" TEA_CONFIG_DIR="''${XDG_CONFIG_HOME:-$HOME/.config}/tea"
TEA_CONFIG_FILE="$TEA_CONFIG_DIR/config.yml" TEA_CONFIG_FILE="$TEA_CONFIG_DIR/config.yml"
# Function to setup tea authentication with rbw # Function to setup tea authentication with rbw
@@ -37,7 +37,7 @@ pkgs.writeShellScriptBin "tea" ''
mkdir -p "$TEA_CONFIG_DIR" mkdir -p "$TEA_CONFIG_DIR"
# Setup tea login # Setup tea login
if ! ${pkgs.tea}/bin/tea login add --name "default" --url "$gitea_url" --token "$token" --insecure-skip-verify=false; then if ! ${pkgs.tea}/bin/tea login add --name "default" --url "$gitea_url" --token "$token"; then
echo "Error: Failed to setup tea authentication" echo "Error: Failed to setup tea authentication"
exit 1 exit 1
fi fi
@@ -46,7 +46,10 @@ pkgs.writeShellScriptBin "tea" ''
} }
# Check if tea is already configured # Check if tea is already configured
if [[ ! -f "$TEA_CONFIG_FILE" ]] || ! ${pkgs.tea}/bin/tea whoami &>/dev/null; then if [[ ! -f "$TEA_CONFIG_FILE" ]]; then
setup_tea_auth
elif ! ${pkgs.tea}/bin/tea whoami &>/dev/null; then
echo "Tea config exists but authentication failed. Re-running setup..."
setup_tea_auth setup_tea_auth
fi fi