diff --git a/dev/troubleshooting/login_test.sh b/dev/troubleshooting/login_test.sh index 3d0204e..89aa6d3 100755 --- a/dev/troubleshooting/login_test.sh +++ b/dev/troubleshooting/login_test.sh @@ -43,6 +43,11 @@ if [[ -z "$url" || -z "$user" ]]; then usage fi +if [[ -n "$DIGMA_PASSWORD" ]]; then + echo "Using password from DIGMA_PASSWORD environment variable" + pwd="$DIGMA_PASSWORD" +fi + # Prompt for password if not provided if [[ -z "$pwd" ]]; then echo -n "Enter password for user '$user': " @@ -50,6 +55,13 @@ if [[ -z "$pwd" ]]; then echo "" fi +if [[ -z "$pwd" ]]; then + echo "Password is required but not provided. Please run the script with --pwd option or set DIGMA_PASSWORD environment variable." >&2 + echo "Example: DIGMA_PASSWORD=mypassword curl -s https://raw.githubusercontent.com/digma-ai/digma/main/dev/troubleshooting/login_test.sh | bash -s -- --url --user --token " >&2 + exit 1 +fi + + echo -n "login to $url/Authentication/login" echo "" response=$(curl -s -w "HTTPSTATUS:%{http_code}" -X 'POST' \