From 704f4b6f057e5c3a872e8418db64f1cfc79138e0 Mon Sep 17 00:00:00 2001 From: anaxios Date: Tue, 6 Aug 2024 19:53:52 -0700 Subject: [PATCH] Added API key validation to prevent unauthorized access --- aicommit_groq | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aicommit_groq b/aicommit_groq index 9541caf..4bacba0 100755 --- a/aicommit_groq +++ b/aicommit_groq @@ -3,6 +3,11 @@ pushd $(pwd) "$@" >/dev/null TMP_FILE="/tmp/aicommit" +if [[ -z "${GROQ_API_KEY}" ]]; then + echo "API key not set." + exit 1 +fi + system="You are an expert programmer that values clear, unambiguous communication and are specialized in generating concise and informative git commit messages. Only reply with the commit message and nothing else." diff=$(git diff --cached) @@ -34,4 +39,4 @@ fi git commit -e -m "$(cat ${TMP_FILE})" && rm ${TMP_FILE} -popd "$@" >/dev/null \ No newline at end of file +popd "$@" >/dev/null